mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-23 03:19:10 -04:00
ALPHA 3.0.2a
This commit is contained in:
46
vendor/psy/psysh/src/functions.php
vendored
46
vendor/psy/psysh/src/functions.php
vendored
@@ -18,7 +18,7 @@ use Symfony\Component\Console\Input\InputDefinition;
|
||||
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.
|
||||
*
|
||||
@@ -32,7 +32,7 @@ if (!function_exists('Psy\sh')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('Psy\debug')) {
|
||||
if (!\function_exists('Psy\debug')) {
|
||||
/**
|
||||
* Invoke a Psy Shell from the current context.
|
||||
*
|
||||
@@ -89,7 +89,7 @@ if (!function_exists('Psy\debug')) {
|
||||
$sh->addInput('whereami -n2', true);
|
||||
}
|
||||
|
||||
if (is_string($bindTo)) {
|
||||
if (\is_string($bindTo)) {
|
||||
$sh->setBoundClass($bindTo);
|
||||
} elseif ($bindTo !== null) {
|
||||
$sh->setBoundObject($bindTo);
|
||||
@@ -101,7 +101,7 @@ if (!function_exists('Psy\debug')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('Psy\info')) {
|
||||
if (!\function_exists('Psy\info')) {
|
||||
/**
|
||||
* Get a bunch of debugging info about the current PsySH environment and
|
||||
* configuration.
|
||||
@@ -123,12 +123,12 @@ if (!function_exists('Psy\info')) {
|
||||
}
|
||||
|
||||
$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;
|
||||
}
|
||||
@@ -146,7 +146,7 @@ if (!function_exists('Psy\info')) {
|
||||
'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(),
|
||||
@@ -171,12 +171,12 @@ if (!function_exists('Psy\info')) {
|
||||
];
|
||||
|
||||
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'])) {
|
||||
@@ -193,12 +193,12 @@ if (!function_exists('Psy\info')) {
|
||||
}
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ if (!function_exists('Psy\info')) {
|
||||
$val = $d->format(\DateTime::RFC2822);
|
||||
break;
|
||||
}
|
||||
$key = 'db ' . str_replace('_', ' ', $key);
|
||||
$key = 'db ' . \str_replace('_', ' ', $key);
|
||||
$docs[$key] = $val;
|
||||
}
|
||||
} else {
|
||||
@@ -243,25 +243,25 @@ if (!function_exists('Psy\info')) {
|
||||
|
||||
$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.
|
||||
*
|
||||
@@ -313,7 +313,7 @@ if (!function_exists('Psy\bin')) {
|
||||
}
|
||||
|
||||
$version = $shell->getVersion();
|
||||
$name = basename(reset($_SERVER['argv']));
|
||||
$name = \basename(\reset($_SERVER['argv']));
|
||||
echo <<<EOL
|
||||
$version
|
||||
|
||||
|
||||
Reference in New Issue
Block a user