use Symfony\Component\Console\Input\InputOption;
use XdgBaseDir\Xdg;
-if (!function_exists('Psy\sh')) {
+if (!\function_exists('Psy\sh')) {
/**
* Command to return the eval-able code to startup PsySH.
*
}
}
-if (!function_exists('Psy\debug')) {
+if (!\function_exists('Psy\debug')) {
/**
* Invoke a Psy Shell from the current context.
*
$sh->addInput('whereami -n2', true);
}
- if (is_string($bindTo)) {
+ if (\is_string($bindTo)) {
$sh->setBoundClass($bindTo);
} elseif ($bindTo !== null) {
$sh->setBoundObject($bindTo);
}
}
-if (!function_exists('Psy\info')) {
+if (!\function_exists('Psy\info')) {
/**
* Get a bunch of debugging info about the current PsySH environment and
* configuration.
}
$xdg = new Xdg();
- $home = rtrim(str_replace('\\', '/', $xdg->getHomeDir()), '/');
- $homePattern = '#^' . preg_quote($home, '#') . '/#';
+ $home = \rtrim(\str_replace('\\', '/', $xdg->getHomeDir()), '/');
+ $homePattern = '#^' . \preg_quote($home, '#') . '/#';
$prettyPath = function ($path) use ($homePattern) {
- if (is_string($path)) {
- return preg_replace($homePattern, '~/', $path);
+ if (\is_string($path)) {
+ return \preg_replace($homePattern, '~/', $path);
} else {
return $path;
}
'config file' => [
'default config file' => $prettyPath($config->getConfigFile()),
'local config file' => $prettyPath($config->getLocalConfigFile()),
- 'PSYSH_CONFIG env' => $prettyPath(getenv('PSYSH_CONFIG')),
+ 'PSYSH_CONFIG env' => $prettyPath(\getenv('PSYSH_CONFIG')),
],
// 'config dir' => $config->getConfigDir(),
// 'data dir' => $config->getDataDir(),
];
if ($config->hasReadline()) {
- $info = readline_info();
+ $info = \readline_info();
$readline = [
'readline available' => true,
'readline enabled' => $config->useReadline(),
- 'readline service' => get_class($config->getReadline()),
+ 'readline service' => \get_class($config->getReadline()),
];
if (isset($info['library_version'])) {
}
$pcntl = [
- 'pcntl available' => function_exists('pcntl_signal'),
- 'posix available' => function_exists('posix_getpid'),
+ 'pcntl available' => \function_exists('pcntl_signal'),
+ 'posix available' => \function_exists('posix_getpid'),
];
- $disabledFuncs = array_map('trim', explode(',', ini_get('disable_functions')));
- if (in_array('pcntl_signal', $disabledFuncs) || in_array('pcntl_fork', $disabledFuncs)) {
+ $disabledFuncs = \array_map('trim', \explode(',', \ini_get('disable_functions')));
+ if (\in_array('pcntl_signal', $disabledFuncs) || \in_array('pcntl_fork', $disabledFuncs)) {
$pcntl['pcntl disabled'] = true;
}
$val = $d->format(\DateTime::RFC2822);
break;
}
- $key = 'db ' . str_replace('_', ' ', $key);
+ $key = 'db ' . \str_replace('_', ' ', $key);
$docs[$key] = $val;
}
} else {
$autocomplete = [
'tab completion enabled' => $config->useTabCompletion(),
- 'custom matchers' => array_map('get_class', $config->getTabCompletionMatchers()),
+ 'custom matchers' => \array_map('get_class', $config->getTabCompletionMatchers()),
'bracketed paste' => $config->useBracketedPaste(),
];
// Shenanigans, but totally justified.
if ($shell = Sudo::fetchProperty($config, 'shell')) {
- $core['loop listeners'] = array_map('get_class', Sudo::fetchProperty($shell, 'loopListeners'));
- $core['commands'] = array_map('get_class', $shell->all());
+ $core['loop listeners'] = \array_map('get_class', Sudo::fetchProperty($shell, 'loopListeners'));
+ $core['commands'] = \array_map('get_class', $shell->all());
- $autocomplete['custom matchers'] = array_map('get_class', Sudo::fetchProperty($shell, 'matchers'));
+ $autocomplete['custom matchers'] = \array_map('get_class', Sudo::fetchProperty($shell, 'matchers'));
}
// @todo Show Presenter / custom casters.
- return array_merge($core, compact('updates', 'pcntl', 'readline', 'history', 'docs', 'autocomplete'));
+ return \array_merge($core, \compact('updates', 'pcntl', 'readline', 'history', 'docs', 'autocomplete'));
}
}
-if (!function_exists('Psy\bin')) {
+if (!\function_exists('Psy\bin')) {
/**
* `psysh` command line executable.
*
}
$version = $shell->getVersion();
- $name = basename(reset($_SERVER['argv']));
+ $name = \basename(\reset($_SERVER['argv']));
echo <<<EOL
$version