Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace yii\console\controllers; use Yii; use yii\base\Application; use yii\conso..
Decoded Output download
<?php
namespace yii\console\controllers; use Yii; use yii\base\Application; use yii\console\Controller; use yii\console\Exception; use yii\helpers\Console; use yii\helpers\Inflector; class HelpController extends Controller { public function actionIndex($command = null) { if ($command !== null) { $result = Yii::$app->createController($command); if ($result === false) { $name = $this->ansiFormat($command, Console::FG_YELLOW); throw new Exception("No help for unknown command "{$name}"."); } list($controller, $actionID) = $result; $actions = $this->getActions($controller); if ($actionID !== '' || count($actions) === 1 && $actions[0] === $controller->defaultAction) { $this->getSubCommandHelp($controller, $actionID); } else { $this->getCommandHelp($controller); } } else { $this->getDefaultHelp(); } } public function actionList() { foreach ($this->getCommandDescriptions() as $command => $description) { $result = Yii::$app->createController($command); list($controller, $actionID) = $result; $actions = $this->getActions($controller); $prefix = $controller->getUniqueId(); if ($controller->createAction($controller->defaultAction) !== null) { $this->stdout("{$prefix}
"); } foreach ($actions as $action) { $this->stdout("{$prefix}/{$action}
"); } } } public function actionListActionOptions($action) { $result = Yii::$app->createController($action); if ($result === false || !$result[0] instanceof Controller) { return; } list($controller, $actionID) = $result; $action = $controller->createAction($actionID); if ($action === null) { return; } foreach ($controller->getActionArgsHelp($action) as $argument => $help) { $description = preg_replace("~\R~", '', addcslashes($help["comment"], ":")) ?: $argument; $this->stdout($argument . ":" . $description . "\xa"); } $this->stdout("
"); foreach ($controller->getActionOptionsHelp($action) as $argument => $help) { $description = preg_replace("~\R~", '', addcslashes($help["comment"], ":")); $this->stdout("--" . $argument . ($description ? ":" . $description : '') . "\xa"); } } public function actionUsage($action) { $result = Yii::$app->createController($action); if ($result === false || !$result[0] instanceof Controller) { return; } list($controller, $actionID) = $result; $action = $controller->createAction($actionID); if ($action === null) { return; } $scriptName = $this->getScriptName(); if ($action->id === $controller->defaultAction) { $this->stdout($scriptName . " " . $this->ansiFormat($controller->getUniqueId(), Console::FG_YELLOW)); } else { $this->stdout($scriptName . " " . $this->ansiFormat($action->getUniqueId(), Console::FG_YELLOW)); } foreach ($controller->getActionArgsHelp($action) as $name => $arg) { if ($arg["required"]) { $this->stdout(" <" . $name . ">", Console::FG_CYAN); } else { $this->stdout(" [" . $name . "]", Console::FG_CYAN); } } $this->stdout("\xa"); } public function getCommands() { $commands = $this->getModuleCommands(Yii::$app); sort($commands); return array_filter(array_unique($commands), function ($command) { $result = Yii::$app->createController($command); if ($result === false || !$result[0] instanceof Controller) { return false; } list($controller, $actionID) = $result; $actions = $this->getActions($controller); return $actions !== array(); }); } protected function getCommandDescriptions() { $descriptions = array(); foreach ($this->getCommands() as $command) { $result = Yii::$app->createController($command); list($controller, $actionID) = $result; $descriptions[$command] = $controller->getHelpSummary(); } return $descriptions; } public function getActions($controller) { $actions = array_keys($controller->actions()); $class = new \ReflectionClass($controller); foreach ($class->getMethods() as $method) { $name = $method->getName(); if ($name !== "actions" && $method->isPublic() && !$method->isStatic() && strncmp($name, "action", 6) === 0) { $actions[] = $this->camel2id(substr($name, 6)); } } sort($actions); return array_unique($actions); } protected function getModuleCommands($module) { $prefix = $module instanceof Application ? '' : $module->getUniqueId() . "/"; $commands = array(); foreach (array_keys($module->controllerMap) as $id) { $commands[] = $prefix . $id; } foreach ($module->getModules() as $id => $child) { if (($child = $module->getModule($id)) === null) { continue; } foreach ($this->getModuleCommands($child) as $command) { $commands[] = $command; } } $controllerPath = $module->getControllerPath(); if (is_dir($controllerPath)) { $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($controllerPath, \RecursiveDirectoryIterator::KEY_AS_PATHNAME)); $iterator = new \RegexIterator($iterator, "/.*Controller\.php$/", \RecursiveRegexIterator::GET_MATCH); foreach ($iterator as $matches) { $file = $matches[0]; $relativePath = str_replace($controllerPath, '', $file); $class = strtr($relativePath, array("/" => "\", ".php" => '')); $controllerClass = $module->controllerNamespace . $class; if ($this->validateControllerClass($controllerClass)) { $dir = ltrim(pathinfo($relativePath, PATHINFO_DIRNAME), "\/"); $command = Inflector::camel2id(substr(basename($file), 0, -14), "-", true); if (!empty($dir)) { $command = $dir . "/" . $command; } $commands[] = $prefix . $command; } } } return $commands; } protected function validateControllerClass($controllerClass) { if (class_exists($controllerClass)) { $class = new \ReflectionClass($controllerClass); return !$class->isAbstract() && $class->isSubclassOf("yii\console\Controller"); } return false; } protected function getDefaultHelp() { $commands = $this->getCommandDescriptions(); $this->stdout($this->getDefaultHelpHeader()); if (empty($commands)) { $this->stdout("
No commands are found.\xa\xa", Console::BOLD); return; } $this->stdout("\xaThe following commands are available:\xa
", Console::BOLD); $maxLength = 0; foreach ($commands as $command => $description) { $result = Yii::$app->createController($command); list($controller, $actionID) = $result; $actions = $this->getActions($controller); $prefix = $controller->getUniqueId(); foreach ($actions as $action) { $string = $prefix . "/" . $action; if ($action === $controller->defaultAction) { $string .= " (default)"; } $maxLength = max($maxLength, strlen($string)); } } foreach ($commands as $command => $description) { $result = Yii::$app->createController($command); list($controller, $actionID) = $result; $actions = $this->getActions($controller); $this->stdout("- " . $this->ansiFormat($command, Console::FG_YELLOW)); $this->stdout(str_repeat(" ", $maxLength + 4 - strlen($command))); $this->stdout(Console::wrapText($description, $maxLength + 4 + 2), Console::BOLD); $this->stdout("
"); $prefix = $controller->getUniqueId(); foreach ($actions as $action) { $string = " " . $prefix . "/" . $action; $this->stdout(" " . $this->ansiFormat($string, Console::FG_GREEN)); if ($action === $controller->defaultAction) { $string .= " (default)"; $this->stdout(" (default)", Console::FG_YELLOW); } $summary = $controller->getActionHelpSummary($controller->createAction($action)); if ($summary !== '') { $this->stdout(str_repeat(" ", $maxLength + 4 - strlen($string))); $this->stdout(Console::wrapText($summary, $maxLength + 4 + 2)); } $this->stdout("\xa"); } $this->stdout("\xa"); } $scriptName = $this->getScriptName(); $this->stdout("
To see the help of each command, enter:\xa", Console::BOLD); $this->stdout("\xa {$scriptName} " . $this->ansiFormat("help", Console::FG_YELLOW) . " " . $this->ansiFormat("<command-name>", Console::FG_CYAN) . "
\xa"); } protected function getCommandHelp($controller) { $controller->color = $this->color; $this->stdout("\xaDESCRIPTION
", Console::BOLD); $comment = $controller->getHelp(); if ($comment !== '') { $this->stdout("
{$comment}\xa
"); } $actions = $this->getActions($controller); if (!empty($actions)) { $this->stdout("
SUB-COMMANDS
", Console::BOLD); $prefix = $controller->getUniqueId(); $maxlen = 5; foreach ($actions as $action) { $len = strlen($prefix . "/" . $action) + 2 + ($action === $controller->defaultAction ? 10 : 0); $maxlen = max($maxlen, $len); } foreach ($actions as $action) { $this->stdout("- " . $this->ansiFormat($prefix . "/" . $action, Console::FG_YELLOW)); $len = strlen($prefix . "/" . $action) + 2; if ($action === $controller->defaultAction) { $this->stdout(" (default)", Console::FG_GREEN); $len += 10; } $summary = $controller->getActionHelpSummary($controller->createAction($action)); if ($summary !== '') { $this->stdout(str_repeat(" ", $maxlen - $len + 2) . Console::wrapText($summary, $maxlen + 2)); } $this->stdout("
"); } $scriptName = $this->getScriptName(); $this->stdout("
To see the detailed information about individual sub-commands, enter:
"); $this->stdout("
{$scriptName} " . $this->ansiFormat("help", Console::FG_YELLOW) . " " . $this->ansiFormat("<sub-command>", Console::FG_CYAN) . "\xa
"); } } protected function getSubCommandHelp($controller, $actionID) { $action = $controller->createAction($actionID); if ($action === null) { $name = $this->ansiFormat(rtrim($controller->getUniqueId() . "/" . $actionID, "/"), Console::FG_YELLOW); throw new Exception("No help for unknown sub-command "{$name}"."); } $description = $controller->getActionHelp($action); if ($description !== '') { $this->stdout("\xaDESCRIPTION
", Console::BOLD); $this->stdout("
{$description}\xa
"); } $this->stdout("\xaUSAGE
", Console::BOLD); $scriptName = $this->getScriptName(); if ($action->id === $controller->defaultAction) { $this->stdout($scriptName . " " . $this->ansiFormat($controller->getUniqueId(), Console::FG_YELLOW)); } else { $this->stdout($scriptName . " " . $this->ansiFormat($action->getUniqueId(), Console::FG_YELLOW)); } $args = $controller->getActionArgsHelp($action); foreach ($args as $name => $arg) { if ($arg["required"]) { $this->stdout(" <" . $name . ">", Console::FG_CYAN); } else { $this->stdout(" [" . $name . "]", Console::FG_CYAN); } } $options = $controller->getActionOptionsHelp($action); $options[\yii\console\Application::OPTION_APPCONFIG] = array("type" => "string", "default" => null, "comment" => "custom application configuration file path.\xaIf not set, default application configuration is used."); ksort($options); if (!empty($options)) { $this->stdout(" [...options...]", Console::FG_RED); } $this->stdout("\xa
"); if (!empty($args)) { foreach ($args as $name => $arg) { $this->stdout($this->formatOptionHelp("- " . $this->ansiFormat($name, Console::FG_CYAN), $arg["required"], $arg["type"], $arg["default"], $arg["comment"]) . "
"); } } if (!empty($options)) { $this->stdout("\xaOPTIONS
", Console::BOLD); foreach ($options as $name => $option) { $this->stdout($this->formatOptionHelp($this->ansiFormat("--" . $name . $this->formatOptionAliases($controller, $name), Console::FG_RED, empty($option["required"]) ? Console::FG_RED : Console::BOLD), !empty($option["required"]), $option["type"], $option["default"], $option["comment"]) . "
\xa"); } } } protected function formatOptionHelp($name, $required, $type, $defaultValue, $comment) { $comment = trim((string) $comment); $type = trim((string) $type); if (strncmp($type, "bool", 4) === 0) { $type = "boolean, 0 or 1"; } if ($defaultValue !== null && !is_array($defaultValue)) { if ($type === null) { $type = gettype($defaultValue); } if (is_bool($defaultValue)) { $defaultValue = (int) $defaultValue; } if (is_string($defaultValue)) { $defaultValue = "'" . $defaultValue . "'"; } else { $defaultValue = var_export($defaultValue, true); } $doc = "{$type} (defaults to {$defaultValue})"; } else { $doc = $type; } if ($doc === '') { $doc = $comment; } elseif ($comment !== '') { $doc .= "
" . preg_replace("/^/m", " ", $comment); } $name = $required ? "{$name} (required)" : $name; return $doc === '' ? $name : "{$name}: {$doc}"; } protected function formatOptionAliases($controller, $option) { foreach ($controller->optionAliases() as $name => $value) { if (Inflector::camel2id($value, "-", true) === $option) { return ", -" . $name; } } return ''; } protected function getScriptName() { return basename(Yii::$app->request->scriptFile); } protected function getDefaultHelpHeader() { return "\xaThis is Yii version " . \Yii::getVersion() . ".\xa"; } private function camel2id($name) { return mb_strtolower(trim(preg_replace("/\p{Lu}/u", "-\0", $name), "-"), "UTF-8"); } } ?>
Did this file decode correctly?
Original Code
<?php
namespace yii\console\controllers; use Yii; use yii\base\Application; use yii\console\Controller; use yii\console\Exception; use yii\helpers\Console; use yii\helpers\Inflector; class HelpController extends Controller { public function actionIndex($command = null) { if ($command !== null) { $result = Yii::$app->createController($command); if ($result === false) { $name = $this->ansiFormat($command, Console::FG_YELLOW); throw new Exception("\x4e\x6f\x20\x68\145\x6c\160\x20\146\x6f\x72\40\x75\x6e\x6b\x6e\x6f\x77\156\40\143\x6f\x6d\155\141\x6e\x64\40\x22{$name}\42\56"); } list($controller, $actionID) = $result; $actions = $this->getActions($controller); if ($actionID !== '' || count($actions) === 1 && $actions[0] === $controller->defaultAction) { $this->getSubCommandHelp($controller, $actionID); } else { $this->getCommandHelp($controller); } } else { $this->getDefaultHelp(); } } public function actionList() { foreach ($this->getCommandDescriptions() as $command => $description) { $result = Yii::$app->createController($command); list($controller, $actionID) = $result; $actions = $this->getActions($controller); $prefix = $controller->getUniqueId(); if ($controller->createAction($controller->defaultAction) !== null) { $this->stdout("{$prefix}\12"); } foreach ($actions as $action) { $this->stdout("{$prefix}\57{$action}\12"); } } } public function actionListActionOptions($action) { $result = Yii::$app->createController($action); if ($result === false || !$result[0] instanceof Controller) { return; } list($controller, $actionID) = $result; $action = $controller->createAction($actionID); if ($action === null) { return; } foreach ($controller->getActionArgsHelp($action) as $argument => $help) { $description = preg_replace("\x7e\134\x52\x7e", '', addcslashes($help["\x63\157\155\x6d\x65\x6e\x74"], "\72")) ?: $argument; $this->stdout($argument . "\72" . $description . "\xa"); } $this->stdout("\12"); foreach ($controller->getActionOptionsHelp($action) as $argument => $help) { $description = preg_replace("\176\134\122\176", '', addcslashes($help["\143\157\155\x6d\145\156\x74"], "\72")); $this->stdout("\55\55" . $argument . ($description ? "\x3a" . $description : '') . "\xa"); } } public function actionUsage($action) { $result = Yii::$app->createController($action); if ($result === false || !$result[0] instanceof Controller) { return; } list($controller, $actionID) = $result; $action = $controller->createAction($actionID); if ($action === null) { return; } $scriptName = $this->getScriptName(); if ($action->id === $controller->defaultAction) { $this->stdout($scriptName . "\x20" . $this->ansiFormat($controller->getUniqueId(), Console::FG_YELLOW)); } else { $this->stdout($scriptName . "\40" . $this->ansiFormat($action->getUniqueId(), Console::FG_YELLOW)); } foreach ($controller->getActionArgsHelp($action) as $name => $arg) { if ($arg["\162\145\161\x75\x69\x72\x65\x64"]) { $this->stdout("\40\74" . $name . "\x3e", Console::FG_CYAN); } else { $this->stdout("\x20\133" . $name . "\x5d", Console::FG_CYAN); } } $this->stdout("\xa"); } public function getCommands() { $commands = $this->getModuleCommands(Yii::$app); sort($commands); return array_filter(array_unique($commands), function ($command) { $result = Yii::$app->createController($command); if ($result === false || !$result[0] instanceof Controller) { return false; } list($controller, $actionID) = $result; $actions = $this->getActions($controller); return $actions !== array(); }); } protected function getCommandDescriptions() { $descriptions = array(); foreach ($this->getCommands() as $command) { $result = Yii::$app->createController($command); list($controller, $actionID) = $result; $descriptions[$command] = $controller->getHelpSummary(); } return $descriptions; } public function getActions($controller) { $actions = array_keys($controller->actions()); $class = new \ReflectionClass($controller); foreach ($class->getMethods() as $method) { $name = $method->getName(); if ($name !== "\141\x63\x74\x69\x6f\156\163" && $method->isPublic() && !$method->isStatic() && strncmp($name, "\141\x63\164\x69\157\x6e", 6) === 0) { $actions[] = $this->camel2id(substr($name, 6)); } } sort($actions); return array_unique($actions); } protected function getModuleCommands($module) { $prefix = $module instanceof Application ? '' : $module->getUniqueId() . "\x2f"; $commands = array(); foreach (array_keys($module->controllerMap) as $id) { $commands[] = $prefix . $id; } foreach ($module->getModules() as $id => $child) { if (($child = $module->getModule($id)) === null) { continue; } foreach ($this->getModuleCommands($child) as $command) { $commands[] = $command; } } $controllerPath = $module->getControllerPath(); if (is_dir($controllerPath)) { $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($controllerPath, \RecursiveDirectoryIterator::KEY_AS_PATHNAME)); $iterator = new \RegexIterator($iterator, "\x2f\56\52\103\x6f\156\x74\162\x6f\x6c\154\x65\162\x5c\x2e\160\x68\160\x24\57", \RecursiveRegexIterator::GET_MATCH); foreach ($iterator as $matches) { $file = $matches[0]; $relativePath = str_replace($controllerPath, '', $file); $class = strtr($relativePath, array("\x2f" => "\134", "\56\x70\x68\160" => '')); $controllerClass = $module->controllerNamespace . $class; if ($this->validateControllerClass($controllerClass)) { $dir = ltrim(pathinfo($relativePath, PATHINFO_DIRNAME), "\134\x2f"); $command = Inflector::camel2id(substr(basename($file), 0, -14), "\x2d", true); if (!empty($dir)) { $command = $dir . "\x2f" . $command; } $commands[] = $prefix . $command; } } } return $commands; } protected function validateControllerClass($controllerClass) { if (class_exists($controllerClass)) { $class = new \ReflectionClass($controllerClass); return !$class->isAbstract() && $class->isSubclassOf("\171\x69\151\x5c\143\157\156\x73\157\x6c\x65\134\x43\157\156\x74\x72\157\154\x6c\145\x72"); } return false; } protected function getDefaultHelp() { $commands = $this->getCommandDescriptions(); $this->stdout($this->getDefaultHelpHeader()); if (empty($commands)) { $this->stdout("\12\116\x6f\x20\143\157\155\155\x61\x6e\144\x73\40\141\x72\x65\40\146\157\x75\156\x64\56\xa\xa", Console::BOLD); return; } $this->stdout("\xa\124\x68\145\x20\146\157\154\154\x6f\167\x69\x6e\147\x20\x63\157\x6d\155\x61\x6e\x64\x73\40\141\162\145\40\x61\166\141\x69\154\141\142\154\145\x3a\xa\12", Console::BOLD); $maxLength = 0; foreach ($commands as $command => $description) { $result = Yii::$app->createController($command); list($controller, $actionID) = $result; $actions = $this->getActions($controller); $prefix = $controller->getUniqueId(); foreach ($actions as $action) { $string = $prefix . "\57" . $action; if ($action === $controller->defaultAction) { $string .= "\40\50\x64\145\x66\x61\165\x6c\x74\51"; } $maxLength = max($maxLength, strlen($string)); } } foreach ($commands as $command => $description) { $result = Yii::$app->createController($command); list($controller, $actionID) = $result; $actions = $this->getActions($controller); $this->stdout("\x2d\x20" . $this->ansiFormat($command, Console::FG_YELLOW)); $this->stdout(str_repeat("\40", $maxLength + 4 - strlen($command))); $this->stdout(Console::wrapText($description, $maxLength + 4 + 2), Console::BOLD); $this->stdout("\12"); $prefix = $controller->getUniqueId(); foreach ($actions as $action) { $string = "\40\40" . $prefix . "\57" . $action; $this->stdout("\40\x20" . $this->ansiFormat($string, Console::FG_GREEN)); if ($action === $controller->defaultAction) { $string .= "\x20\50\144\x65\146\141\165\154\x74\51"; $this->stdout("\x20\50\144\145\x66\141\165\x6c\164\51", Console::FG_YELLOW); } $summary = $controller->getActionHelpSummary($controller->createAction($action)); if ($summary !== '') { $this->stdout(str_repeat("\40", $maxLength + 4 - strlen($string))); $this->stdout(Console::wrapText($summary, $maxLength + 4 + 2)); } $this->stdout("\xa"); } $this->stdout("\xa"); } $scriptName = $this->getScriptName(); $this->stdout("\12\x54\157\x20\x73\x65\x65\x20\164\x68\x65\40\x68\x65\x6c\160\40\157\x66\x20\x65\x61\143\x68\x20\143\x6f\155\x6d\141\156\144\54\x20\x65\156\164\x65\x72\x3a\xa", Console::BOLD); $this->stdout("\xa\40\x20{$scriptName}\40" . $this->ansiFormat("\x68\x65\154\160", Console::FG_YELLOW) . "\40" . $this->ansiFormat("\x3c\143\x6f\x6d\x6d\x61\156\144\x2d\x6e\141\x6d\x65\x3e", Console::FG_CYAN) . "\12\xa"); } protected function getCommandHelp($controller) { $controller->color = $this->color; $this->stdout("\xa\x44\105\123\103\122\111\x50\124\x49\x4f\116\12", Console::BOLD); $comment = $controller->getHelp(); if ($comment !== '') { $this->stdout("\12{$comment}\xa\12"); } $actions = $this->getActions($controller); if (!empty($actions)) { $this->stdout("\12\x53\125\102\x2d\103\117\x4d\x4d\x41\x4e\x44\x53\12\12", Console::BOLD); $prefix = $controller->getUniqueId(); $maxlen = 5; foreach ($actions as $action) { $len = strlen($prefix . "\x2f" . $action) + 2 + ($action === $controller->defaultAction ? 10 : 0); $maxlen = max($maxlen, $len); } foreach ($actions as $action) { $this->stdout("\x2d\x20" . $this->ansiFormat($prefix . "\57" . $action, Console::FG_YELLOW)); $len = strlen($prefix . "\57" . $action) + 2; if ($action === $controller->defaultAction) { $this->stdout("\x20\50\x64\145\x66\x61\165\154\x74\51", Console::FG_GREEN); $len += 10; } $summary = $controller->getActionHelpSummary($controller->createAction($action)); if ($summary !== '') { $this->stdout(str_repeat("\x20", $maxlen - $len + 2) . Console::wrapText($summary, $maxlen + 2)); } $this->stdout("\12"); } $scriptName = $this->getScriptName(); $this->stdout("\12\x54\x6f\x20\163\x65\145\40\x74\150\x65\x20\x64\x65\164\x61\x69\x6c\145\144\40\x69\x6e\146\157\162\x6d\141\x74\x69\x6f\x6e\40\141\142\157\165\164\40\x69\156\x64\151\x76\x69\144\165\141\154\x20\x73\x75\x62\x2d\x63\x6f\155\155\141\156\144\x73\54\40\x65\x6e\164\x65\162\72\12"); $this->stdout("\12\40\x20{$scriptName}\x20" . $this->ansiFormat("\x68\x65\154\160", Console::FG_YELLOW) . "\40" . $this->ansiFormat("\x3c\163\x75\x62\55\143\x6f\x6d\155\141\x6e\x64\x3e", Console::FG_CYAN) . "\xa\12"); } } protected function getSubCommandHelp($controller, $actionID) { $action = $controller->createAction($actionID); if ($action === null) { $name = $this->ansiFormat(rtrim($controller->getUniqueId() . "\x2f" . $actionID, "\57"), Console::FG_YELLOW); throw new Exception("\116\x6f\40\x68\x65\x6c\x70\40\146\x6f\162\40\165\156\x6b\156\157\167\x6e\40\x73\x75\x62\55\x63\157\x6d\x6d\141\x6e\x64\40\x22{$name}\x22\56"); } $description = $controller->getActionHelp($action); if ($description !== '') { $this->stdout("\xa\x44\105\123\x43\x52\x49\x50\x54\111\117\116\12", Console::BOLD); $this->stdout("\12{$description}\xa\12"); } $this->stdout("\xa\x55\123\101\107\105\12\12", Console::BOLD); $scriptName = $this->getScriptName(); if ($action->id === $controller->defaultAction) { $this->stdout($scriptName . "\x20" . $this->ansiFormat($controller->getUniqueId(), Console::FG_YELLOW)); } else { $this->stdout($scriptName . "\x20" . $this->ansiFormat($action->getUniqueId(), Console::FG_YELLOW)); } $args = $controller->getActionArgsHelp($action); foreach ($args as $name => $arg) { if ($arg["\x72\x65\161\165\151\x72\x65\x64"]) { $this->stdout("\x20\74" . $name . "\76", Console::FG_CYAN); } else { $this->stdout("\40\x5b" . $name . "\135", Console::FG_CYAN); } } $options = $controller->getActionOptionsHelp($action); $options[\yii\console\Application::OPTION_APPCONFIG] = array("\164\171\x70\x65" => "\163\x74\162\x69\x6e\147", "\144\145\146\141\165\154\x74" => null, "\143\x6f\x6d\155\145\156\164" => "\143\165\163\x74\x6f\155\40\x61\160\160\x6c\x69\x63\141\x74\x69\x6f\x6e\x20\143\x6f\156\x66\151\147\165\x72\x61\x74\151\157\156\40\146\x69\154\x65\x20\x70\141\164\150\x2e\xa\111\x66\40\156\157\x74\40\x73\x65\x74\54\40\144\145\146\x61\x75\154\164\40\141\x70\160\x6c\x69\x63\141\164\151\x6f\156\x20\143\157\x6e\x66\151\x67\x75\162\x61\164\x69\x6f\156\40\x69\163\x20\165\163\145\x64\56"); ksort($options); if (!empty($options)) { $this->stdout("\40\133\56\x2e\x2e\x6f\160\x74\151\157\x6e\163\56\x2e\x2e\135", Console::FG_RED); } $this->stdout("\xa\12"); if (!empty($args)) { foreach ($args as $name => $arg) { $this->stdout($this->formatOptionHelp("\55\40" . $this->ansiFormat($name, Console::FG_CYAN), $arg["\x72\x65\x71\165\151\162\x65\x64"], $arg["\164\171\160\x65"], $arg["\144\x65\146\x61\165\154\164"], $arg["\143\157\155\x6d\x65\x6e\164"]) . "\12\12"); } } if (!empty($options)) { $this->stdout("\xa\x4f\120\x54\x49\117\x4e\x53\12\12", Console::BOLD); foreach ($options as $name => $option) { $this->stdout($this->formatOptionHelp($this->ansiFormat("\x2d\55" . $name . $this->formatOptionAliases($controller, $name), Console::FG_RED, empty($option["\162\x65\x71\x75\x69\x72\145\x64"]) ? Console::FG_RED : Console::BOLD), !empty($option["\162\x65\x71\165\x69\162\x65\144"]), $option["\x74\171\160\x65"], $option["\144\x65\x66\141\x75\x6c\164"], $option["\x63\157\155\155\x65\156\164"]) . "\12\xa"); } } } protected function formatOptionHelp($name, $required, $type, $defaultValue, $comment) { $comment = trim((string) $comment); $type = trim((string) $type); if (strncmp($type, "\x62\x6f\157\154", 4) === 0) { $type = "\x62\x6f\x6f\x6c\145\141\156\54\40\60\40\157\162\x20\61"; } if ($defaultValue !== null && !is_array($defaultValue)) { if ($type === null) { $type = gettype($defaultValue); } if (is_bool($defaultValue)) { $defaultValue = (int) $defaultValue; } if (is_string($defaultValue)) { $defaultValue = "\x27" . $defaultValue . "\x27"; } else { $defaultValue = var_export($defaultValue, true); } $doc = "{$type}\x20\50\144\145\x66\x61\165\154\164\x73\x20\164\x6f\x20{$defaultValue}\x29"; } else { $doc = $type; } if ($doc === '') { $doc = $comment; } elseif ($comment !== '') { $doc .= "\12" . preg_replace("\57\x5e\57\155", "\40\x20", $comment); } $name = $required ? "{$name}\x20\50\162\x65\161\x75\151\162\145\x64\x29" : $name; return $doc === '' ? $name : "{$name}\72\x20{$doc}"; } protected function formatOptionAliases($controller, $option) { foreach ($controller->optionAliases() as $name => $value) { if (Inflector::camel2id($value, "\x2d", true) === $option) { return "\54\x20\55" . $name; } } return ''; } protected function getScriptName() { return basename(Yii::$app->request->scriptFile); } protected function getDefaultHelpHeader() { return "\xa\x54\150\151\x73\x20\151\163\40\x59\151\151\x20\166\145\x72\x73\151\157\x6e\40" . \Yii::getVersion() . "\56\xa"; } private function camel2id($name) { return mb_strtolower(trim(preg_replace("\57\x5c\x70\173\114\165\x7d\57\x75", "\x2d\134\x30", $name), "\x2d"), "\x55\x54\106\55\70"); } }
Function Calls
| None |
Stats
| MD5 | a27939fdaa32b31ebd098a9270418b20 |
| Eval Count | 0 |
| Decode Time | 98 ms |