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


PHP ConsoleOutput::getFormatter方法代码示例

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


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

示例1: configureOutput

 /**
  * Configure the console output with custom styles.
  */
 protected function configureOutput()
 {
     $this->output = new ConsoleOutput();
     $this->output->getFormatter()->setStyle('path', new OutputFormatterStyle('green', null, ['bold']));
     $this->output->getFormatter()->setStyle('time', new OutputFormatterStyle('cyan', null, ['bold']));
     $this->output->getFormatter()->setStyle('b', new OutputFormatterStyle(null, null, ['bold']));
 }
开发者ID:parsnick,项目名称:steak,代码行数:10,代码来源:Application.php

示例2: run

 public function run(InputInterface $input = null, OutputInterface $output = null)
 {
     if (null === $output) {
         $output = new ConsoleOutput();
     }
     $output->getFormatter()->getStyle('info')->setForeground('magenta');
     $output->getFormatter()->getStyle('comment')->setForeground('cyan');
     return parent::run($input, $output);
 }
开发者ID:100hz,项目名称:hive-console,代码行数:9,代码来源:Application.php

示例3: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $home = getenv('HOME');
     if (!$home) {
         throw new \RuntimeException("'HOME' environment variable must be set for Cloud Drive to properly run.");
     }
     $this->configPath = rtrim($home, '/') . '/.cache/clouddrive-php/';
     if (!file_exists($this->configPath)) {
         mkdir($this->configPath, 0777, true);
     }
     $this->configFile = "{$this->configPath}config.json";
     $this->input = $input;
     $this->output = $output;
     // Set up basic styling
     $this->output->getFormatter()->setStyle('blue', new OutputFormatterStyle('blue'));
     $this->readConfig();
     $this->main();
 }
开发者ID:Zn4rK,项目名称:clouddrive-php,代码行数:21,代码来源:Command.php

示例4: __construct

 /**
  * Creates and initializes the SymfonyConsoleOutput instance
  *
  * @return void
  */
 public function __construct()
 {
     $this->output = new SymfonyConsoleOutput();
     $this->output->getFormatter()->setStyle('b', new OutputFormatterStyle(NULL, NULL, array('bold')));
     $this->output->getFormatter()->setStyle('i', new OutputFormatterStyle('black', 'white'));
     $this->output->getFormatter()->setStyle('u', new OutputFormatterStyle(NULL, NULL, array('underscore')));
     $this->output->getFormatter()->setStyle('em', new OutputFormatterStyle(NULL, NULL, array('reverse')));
     $this->output->getFormatter()->setStyle('strike', new OutputFormatterStyle(NULL, NULL, array('conceal')));
     $this->output->getFormatter()->setStyle('error', new OutputFormatterStyle('red'));
     $this->output->getFormatter()->setStyle('success', new OutputFormatterStyle('green'));
 }
开发者ID:sengkimlong,项目名称:Flow3-Authentification,代码行数:16,代码来源:ConsoleOutput.php

示例5: install

 /**
  * install
  *
  * @return void
  */
 public static function install()
 {
     $output = new ConsoleOutput();
     $style = new OutputFormatterStyle('green');
     $output->getFormatter()->setStyle('green', $style);
     $assets = array('resources/cache', 'resources/log', 'web/assets');
     foreach ($assets as $asset) {
         self::createAndChmod($asset, 0777);
         $output->writeln(sprintf('<green>Generating "%s" asset dir</green>', $asset));
     }
     exec('php console assetic:dump');
 }
开发者ID:ronanguilloux,项目名称:silexmarkdown,代码行数:17,代码来源:Script.php

示例6: index

 /**
  * {@inheritdoc}
  */
 public function index()
 {
     $style = new OutputFormatterStyle('red', 'yellow', array('bold', 'blink'));
     $output = new ConsoleOutput();
     $output->getFormatter()->setStyle('fire', $style);
     $fileContents = $this->searchService->getFileContents();
     foreach ($fileContents as $content) {
         $output->writeln('<info>Indexing File & Contents: </info><comment>' . $content['path'] . '</comment>');
         /**
          * @var \Symfony\Component\Finder\SplFileInfo $file
          */
         $this->createIndex($content['title'], $content['file_contents'], $content['path']);
     }
 }
开发者ID:beecms,项目名称:search-bundle,代码行数:17,代码来源:FileSearchWithDBIndexService.php

示例7: handle

 public function handle(Args $args, IO $io, Command $command)
 {
     $output = new ConsoleOutput();
     $style = new OutputFormatterStyle('white', 'black', array('bold'));
     if ($args->getArgument('package') == '') {
         $output->writeln(Cpm\message::USAGE);
         exit;
     }
     if (!file_exists('composer.json')) {
         $output->writeln(Cpm\message::NOComposerJSON);
     }
     $json = file_get_contents('composer.json');
     $array = json_decode($json, TRUE);
     $datas = $array['require'];
     foreach ($datas as $data) {
         $output->getFormatter()->setStyle('bold', $style);
         $output->writeln('<bold>' . $data->name . '</>' . ' ' . $data->description);
         $output->writeln($data->keywords);
     }
     return 0;
 }
开发者ID:php-cpm,项目名称:cpm,代码行数:21,代码来源:InstallCommandHandler.php

示例8: handle

 public function handle(Args $args, IO $io, Command $command)
 {
     $table = new Table();
     $table->setHeaderRow(array('Name', 'Description'));
     $output = new ConsoleOutput();
     $style = new OutputFormatterStyle('white', 'black', array('bold'));
     if ($args->getArgument('package') == '') {
         $output->writeln(Cpm\message::USAGE);
         exit;
     }
     $limit = $args->getOption('limit');
     $limit_str = $limit ? 'limit ' . $limit : '';
     $q = $args->getArgument('package');
     $datas = R::findAll('repo', ' name LIKE ? order by download_monthly desc,favers desc,download_total desc' . $limit_str, ['%' . $q . '%']);
     foreach ($datas as $data) {
         $output->getFormatter()->setStyle('bold', $style);
         //            $output->writeln('<bold>'.$data->name.'</>'.' '.$data->description);
         //            $output->writeln($data->keywords);
         $table->addRow(array("(" . $data->favers . ")" . $data->name, $data->description));
     }
     $table->render($io);
     return 0;
 }
开发者ID:php-cpm,项目名称:cpm,代码行数:23,代码来源:SearchCommandHandler.php

示例9: ConsoleOutput

<?php

include 'vendor/autoload.php';
use RedBeanPHP\R;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
use Symfony\Component\Console\Output\ConsoleOutput;
R::setup('sqlite:db/ppm.db');
$output = new ConsoleOutput();
$style = new OutputFormatterStyle('white', 'black', array('bold'));
if (!isset($argv[1])) {
    $output->writeln(Cpm\message::USAGE);
    exit;
}
$q = $argv[1];
$datas = R::findAll('repo', ' name LIKE ? order by download_total desc', ['%' . $q . '%']);
$a = array();
foreach ($datas as $data) {
    $output->getFormatter()->setStyle('bold', $style);
    $output->writeln('<bold>' . $data->name . '</bold>' . ' ' . $data->description);
    $output->writeln($data->keywords);
}
开发者ID:php-cpm,项目名称:cpm,代码行数:21,代码来源:console.php

示例10: testConstructor

 public function testConstructor()
 {
     $output = new ConsoleOutput(Output::VERBOSITY_QUIET, true);
     $this->assertEquals(Output::VERBOSITY_QUIET, $output->getVerbosity(), '__construct() takes the verbosity as its first argument');
     $this->assertSame($output->getFormatter(), $output->getErrorOutput()->getFormatter(), '__construct() takes a formatter or null as the third argument');
 }
开发者ID:JesseDarellMoore,项目名称:CS499,代码行数:6,代码来源:ConsoleOutputTest.php

示例11: getPrompt

 /**
  * @return string
  */
 protected function getPrompt()
 {
     // using the formatter here is required when using readline
     return $this->output->getFormatter()->format($this->application->getPrompt() . ' > ');
 }
开发者ID:nitso,项目名称:php-sql-console,代码行数:8,代码来源:Shell.php


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