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


PHP Console::markdownToAnsi方法代码示例

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


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

示例1: parseDocCommentDetail

 /**
  * Returns full description from the docblock.
  *
  * @param \Reflector $reflection
  * @return string
  */
 protected function parseDocCommentDetail($reflection)
 {
     $comment = strtr(trim(preg_replace('/^\\s*\\**( |\\t)?/m', '', trim($reflection->getDocComment(), '/'))), "\r", '');
     if (preg_match('/^\\s*@\\w+/m', $comment, $matches, PREG_OFFSET_CAPTURE)) {
         $comment = trim(substr($comment, 0, $matches[0][1]));
     }
     if ($comment !== '') {
         return rtrim(Console::renderColoredString(Console::markdownToAnsi($comment)));
     }
     return '';
 }
开发者ID:avron99,项目名称:delayed-orders,代码行数:17,代码来源:Controller.php

示例2: getActionHelp

 /**
  * Displays the detailed information of a command action.
  * @param Controller $controller the controller instance
  * @param string $actionID action ID
  * @throws Exception if the action does not exist
  */
 protected function getActionHelp($controller, $actionID)
 {
     $action = $controller->createAction($actionID);
     if ($action === null) {
         throw new Exception(Yii::t('yii', 'No help for unknown sub-command "{command}".', ['command' => rtrim($controller->getUniqueId() . '/' . $actionID, '/')]));
     }
     if ($action instanceof InlineAction) {
         $method = new \ReflectionMethod($controller, $action->actionMethod);
     } else {
         $method = new \ReflectionMethod($action, 'run');
     }
     $tags = $this->parseComment($method->getDocComment());
     $options = $this->getOptionHelps($controller, $actionID);
     if ($tags['description'] !== '') {
         $this->stdout("\nDESCRIPTION\n", Console::BOLD);
         echo "\n" . rtrim(Console::renderColoredString(Console::markdownToAnsi($tags['description']))) . "\n\n";
     }
     $this->stdout("\nUSAGE\n\n", Console::BOLD);
     $scriptName = $this->getScriptName();
     if ($action->id === $controller->defaultAction) {
         echo $scriptName . ' ' . $this->ansiFormat($controller->getUniqueId(), Console::FG_YELLOW);
     } else {
         echo $scriptName . ' ' . $this->ansiFormat($action->getUniqueId(), Console::FG_YELLOW);
     }
     list($required, $optional) = $this->getArgHelps($method, isset($tags['param']) ? $tags['param'] : []);
     foreach ($required as $arg => $description) {
         $this->stdout(' <' . $arg . '>', Console::FG_CYAN);
     }
     foreach ($optional as $arg => $description) {
         $this->stdout(' [' . $arg . ']', Console::FG_CYAN);
     }
     if (!empty($options)) {
         $this->stdout(' [...options...]', Console::FG_RED);
     }
     echo "\n\n";
     if (!empty($required) || !empty($optional)) {
         echo implode("\n\n", array_merge($required, $optional)) . "\n\n";
     }
     if (!empty($options)) {
         $this->stdout("\nOPTIONS\n\n", Console::BOLD);
         echo implode("\n\n", $options) . "\n\n";
     }
 }
开发者ID:bmsrox,项目名称:yiicomm,代码行数:49,代码来源:HelpController.php


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