/** * 显示所有命令列表 */ private function showCommandList() { $controllers = $this->getControllers(); $commands = array(); $len = 0; foreach ($controllers as $controller) { $actions = $this->getControllerActions($controller); if (count($actions) > 0) { foreach ($actions as $name => $action) { $command = str_replace(array_keys(\App::getControllerPaths()), '', substr($controller, 0, -10)); $command = ltrim(strtr($command, '\\', '/'), '/') . '/' . $name; $commands[$controller][$command] = $this->parseCommentSummary($action->getDocComment()); if (strlen($command) > $len) { $len = strlen($command); } } } } foreach ($commands as $controller => $actions) { $class = $this->getReflectionClass($controller); $string = str_replace(array_keys(\App::getControllerPaths()), '', substr($controller, 0, -10)); $string = ltrim(strtr($string, '\\', '/'), '/'); $this->stdout(Console::ansiFormat("- {$string}", Console::FG_YELLOW)); $this->stdout(str_repeat(' ', $len - strlen($string) + 10)); $this->stdout(Console::ansiFormat($this->parseCommentSummary($class->getDocComment()), Console::BOLD)); $this->stdout("\n"); foreach ($actions as $name => $summary) { $this->stdout(' ' . Console::ansiFormat($name, Console::FG_GREEN)); $this->stdout(str_repeat(' ', $len - strlen($name) + 8)); $this->stdout($summary); $this->stdout("\n"); } } }
protected function stdin($raw = false) { return Console::stdin($raw); }