當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。