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


PHP Console::clearLine方法代码示例

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


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

示例1: testStripAnsiFormat

 public function testStripAnsiFormat()
 {
     ob_start();
     ob_implicit_flush(false);
     echo 'a';
     Console::moveCursorForward(1);
     echo 'a';
     Console::moveCursorDown(1);
     echo 'a';
     Console::moveCursorUp(1);
     echo 'a';
     Console::moveCursorBackward(1);
     echo 'a';
     Console::moveCursorNextLine(1);
     echo 'a';
     Console::moveCursorPrevLine(1);
     echo 'a';
     Console::moveCursorTo(1);
     echo 'a';
     Console::moveCursorTo(1, 2);
     echo 'a';
     Console::clearLine();
     echo 'a';
     Console::clearLineAfterCursor();
     echo 'a';
     Console::clearLineBeforeCursor();
     echo 'a';
     Console::clearScreen();
     echo 'a';
     Console::clearScreenAfterCursor();
     echo 'a';
     Console::clearScreenBeforeCursor();
     echo 'a';
     Console::scrollDown();
     echo 'a';
     Console::scrollUp();
     echo 'a';
     Console::hideCursor();
     echo 'a';
     Console::showCursor();
     echo 'a';
     Console::saveCursorPosition();
     echo 'a';
     Console::restoreCursorPosition();
     echo 'a';
     Console::beginAnsiFormat([Console::FG_GREEN, Console::BG_BLUE, Console::UNDERLINE]);
     echo 'a';
     Console::endAnsiFormat();
     echo 'a';
     Console::beginAnsiFormat([Console::xtermBgColor(128), Console::xtermFgColor(55)]);
     echo 'a';
     Console::endAnsiFormat();
     echo 'a';
     $ouput = Console::stripAnsiFormat(ob_get_clean());
     ob_implicit_flush(true);
     // $output = str_replace("\033", 'X003', $ouput );// uncomment for debugging
     $this->assertEquals(str_repeat('a', 25), $ouput);
 }
开发者ID:rajanishtimes,项目名称:basicyii,代码行数:58,代码来源:ConsoleTest.php

示例2: actionFetchTop

 /**
  * Fetches TOP-$count components from Bower ans saves to `config/bower.list`.
  *
  * @param int $count
  * @param bool $skipCache
  */
 public function actionFetchTop($count = 1000, $skipCache = false)
 {
     $result = [];
     $components = $this->getComponents($skipCache);
     ArrayHelper::multisort($components, 'stars', SORT_DESC, SORT_NUMERIC);
     foreach (array_slice($components, 0, $count) as $component) {
         $result[] = 'bower-asset/' . $component['name'];
         echo Console::renderColoredString("%R{$component['stars']}%N - %g{$component['name']}%N");
         Console::moveCursorTo(0);
         Console::clearLine();
     }
     $componentsListPath = Yii::getAlias('@hiqdev/assetpackagist/config/bower.list');
     file_put_contents($componentsListPath, implode("\n", $result));
     echo Console::renderColoredString('Fetched %YBower%N components list. Found %G' . count($components) . "%N components.\n");
     echo Console::renderColoredString('Only %bTOP-' . $count . "%N components were added to the packages list.\n");
     echo Console::renderColoredString('See %G' . $componentsListPath . "%N\n");
 }
开发者ID:hiqdev,项目名称:asset-packagist,代码行数:23,代码来源:BowerPackageController.php

示例3: recursiveScan

 protected function recursiveScan($path, &$migrations)
 {
     $path = \Yii::getAlias($path);
     $alias = $this->getAliasByPath($path);
     echo "Lookup {$alias}\n";
     Console::moveCursorUp();
     $dir = opendir($path);
     while (($file = readdir($dir)) !== false) {
         $subpath = $path . DIRECTORY_SEPARATOR . $file;
         if (in_array($file, ['.', '..', '.git', 'yiisoft', 'models', 'controllers', 'views', 'components'])) {
             continue;
         }
         if (is_dir($subpath)) {
             $this->recursiveScan($subpath, $migrations);
         } else {
             if (preg_match('/^(m(\\d{6}_\\d{6})_.*?)\\.php$/', $file, $matches) && is_file($subpath)) {
                 $migrations[$alias][] = $matches[1];
             }
         }
     }
     closedir($dir);
     Console::clearLine();
     return $migrations;
 }
开发者ID:simplator,项目名称:yii2-migrate-command,代码行数:24,代码来源:MigrateController.php


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