当前位置: 首页>>代码示例>>PHP>>正文


PHP Controller::getHelp方法代码示例

本文整理汇总了PHP中yii\console\Controller::getHelp方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller::getHelp方法的具体用法?PHP Controller::getHelp怎么用?PHP Controller::getHelp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\console\Controller的用法示例。


在下文中一共展示了Controller::getHelp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCommandHelp

 /**
  * Displays the overall information of the command.
  * @param Controller $controller the controller instance
  */
 protected function getCommandHelp($controller)
 {
     $controller->color = $this->color;
     $this->stdout("\nDESCRIPTION\n", Console::BOLD);
     $comment = $controller->getHelp();
     if ($comment !== '') {
         $this->stdout("\n{$comment}\n\n");
     }
     $actions = $this->getActions($controller);
     if (!empty($actions)) {
         $this->stdout("\nSUB-COMMANDS\n\n", Console::BOLD);
         $prefix = $controller->getUniqueId();
         $maxlen = 5;
         foreach ($actions as $action) {
             $len = strlen($prefix . '/' . $action) + 2 + ($action === $controller->defaultAction ? 10 : 0);
             if ($maxlen < $len) {
                 $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("\n");
         }
         $scriptName = $this->getScriptName();
         $this->stdout("\nTo see the detailed information about individual sub-commands, enter:\n");
         $this->stdout("\n  {$scriptName} " . $this->ansiFormat('help', Console::FG_YELLOW) . ' ' . $this->ansiFormat('<sub-command>', Console::FG_CYAN) . "\n\n");
     }
 }
开发者ID:drodata,项目名称:yii2,代码行数:41,代码来源:HelpController.php

示例2: getCommandHelp

 /**
  * Displays the overall information of the command.
  * @param Controller $controller the controller instance
  */
 protected function getCommandHelp($controller)
 {
     $controller->color = $this->color;
     $this->stdout("\nDESCRIPTION\n", Console::BOLD);
     $comment = $controller->getHelp();
     if ($comment !== '') {
         $this->stdout("\n{$comment}\n\n");
     }
     $actions = $this->getActions($controller);
     if (!empty($actions)) {
         $this->stdout("\nSUB-COMMANDS\n\n", Console::BOLD);
         $prefix = $controller->getUniqueId();
         foreach ($actions as $action) {
             echo '- ' . $this->ansiFormat($prefix . '/' . $action, Console::FG_YELLOW);
             if ($action === $controller->defaultAction) {
                 $this->stdout(' (default)', Console::FG_GREEN);
             }
             $summary = $controller->getActionHelpSummary($controller->createAction($action));
             if ($summary !== '') {
                 echo ': ' . $summary;
             }
             echo "\n";
         }
         $scriptName = $this->getScriptName();
         echo "\nTo see the detailed information about individual sub-commands, enter:\n";
         echo "\n  {$scriptName} " . $this->ansiFormat('help', Console::FG_YELLOW) . ' ' . $this->ansiFormat('<sub-command>', Console::FG_CYAN) . "\n\n";
     }
 }
开发者ID:bigpower,项目名称:yii2,代码行数:32,代码来源:HelpController.php


注:本文中的yii\console\Controller::getHelp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。