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


PHP Console::wrapText方法代码示例

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


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

示例1: actionRefreshOnline

 /**
  * Снимаем онлайн у тех, у кого за последнее время активность == 0
  */
 public function actionRefreshOnline()
 {
     $oldTime = time() - \Yii::$app->params['onlineLength'];
     $userUpdated = User::updateAll(['<=', 'updated', $oldTime]);
     $this->stdout(Console::wrapText("- {$userUpdated} отправлено в оффлайн", 10), Console::BOLD);
     $this->stdout("\n");
 }
开发者ID:KPEMATOP,项目名称:findspree_old,代码行数:10,代码来源:UserController.php

示例2: actionGarbageCollector

 /**
  * Удаление старыъ записей (сессии, логов)
  */
 public function actionGarbageCollector()
 {
     $logMain = LogMain::deleteAll(['<=', 'created', time() - Time::SEC_TO_MONTH]);
     $session = Session::deleteAll(['<=', 'expire', time() - \Yii::$app->session->getTimeout()]);
     $this->stdout('- ' . $this->ansiFormat(LogMain::tableName(), Console::FG_YELLOW));
     $this->stdout(' ');
     $this->stdout(Console::wrapText("удалено {$logMain} записей", 10), Console::BOLD);
     $this->stdout("\n");
     $this->stdout('- ' . $this->ansiFormat(Session::tableName(), Console::FG_YELLOW));
     $this->stdout(' ');
     $this->stdout(Console::wrapText("удалено {$session} записей", 10), Console::BOLD);
     $this->stdout("\n");
 }
开发者ID:KPEMATOP,项目名称:findspree_old,代码行数:16,代码来源:WatcherController.php

示例3: actionNormalize

 public function actionNormalize()
 {
     /**
      * @var $tag Tag
      */
     $updated = 0;
     $deleted = 0;
     $list = [];
     foreach (Tag::find()->each() as $tag) {
         $name = mb_strtolower($tag->name);
         if (isset($list[$name])) {
             TagEvent::updateAll(['tag_id' => $list[$name]], ['tag_id' => $tag->id]);
             $tag->delete();
             $deleted++;
             continue;
         }
         $list[$name] = $tag->id;
     }
     $this->stdout(Console::wrapText("- {$updated} updated, {$deleted} deleted", 10), Console::BOLD);
     $this->stdout("\n");
 }
开发者ID:KPEMATOP,项目名称:findspree_old,代码行数:21,代码来源:TagController.php

示例4: 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

示例5: getDefaultHelp

 /**
  * Displays all available commands.
  */
 protected function getDefaultHelp()
 {
     $commands = $this->getCommandDescriptions();
     $this->stdout("\nThis is Yii version " . \Yii::getVersion() . ".\n");
     if (!empty($commands)) {
         $this->stdout("\nThe following commands are available:\n\n", Console::BOLD);
         $len = 0;
         foreach ($commands as $command => $description) {
             $result = Yii::$app->createController($command);
             if ($result !== false) {
                 /** @var $controller Controller */
                 list($controller, $actionID) = $result;
                 $actions = $this->getActions($controller);
                 if (!empty($actions)) {
                     $prefix = $controller->getUniqueId();
                     foreach ($actions as $action) {
                         $string = $prefix . '/' . $action;
                         if ($action === $controller->defaultAction) {
                             $string .= ' (default)';
                         }
                         if (($l = strlen($string)) > $len) {
                             $len = $l;
                         }
                     }
                 }
             } elseif (($l = strlen($command)) > $len) {
                 $len = $l;
             }
         }
         foreach ($commands as $command => $description) {
             $this->stdout('- ' . $this->ansiFormat($command, Console::FG_YELLOW));
             $this->stdout(str_repeat(' ', $len + 4 - strlen($command)));
             $this->stdout(Console::wrapText($description, $len + 4 + 2), Console::BOLD);
             $this->stdout("\n");
             $result = Yii::$app->createController($command);
             if ($result !== false) {
                 list($controller, $actionID) = $result;
                 $actions = $this->getActions($controller);
                 if (!empty($actions)) {
                     $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(' ', $len + 4 - strlen($string)));
                             $this->stdout(Console::wrapText($summary, $len + 4 + 2));
                         }
                         $this->stdout("\n");
                     }
                 }
                 $this->stdout("\n");
             }
         }
         $scriptName = $this->getScriptName();
         $this->stdout("\nTo see the help of each command, enter:\n", Console::BOLD);
         $this->stdout("\n  {$scriptName} " . $this->ansiFormat('help', Console::FG_YELLOW) . ' ' . $this->ansiFormat('<command-name>', Console::FG_CYAN) . "\n\n");
     } else {
         $this->stdout("\nNo commands are found.\n\n", Console::BOLD);
     }
 }
开发者ID:ajnok,项目名称:yii2book,代码行数:68,代码来源:HelpController.php


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