本文整理汇总了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");
}
}
示例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";
}
}