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


PHP OutputInterface::getFormatter方法代码示例

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


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

示例1: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->useIsoStandard = $input->getOption('sunday') == true ? false : true;
     $output->getFormatter()->setStyle('lvl0', new ColorOutputFormatterStyle('lvl0'));
     $output->getFormatter()->setStyle('lvl1', new ColorOutputFormatterStyle('lvl1'));
     $output->getFormatter()->setStyle('lvl2', new ColorOutputFormatterStyle('lvl2'));
     $output->getFormatter()->setStyle('lvl3', new ColorOutputFormatterStyle('lvl3'));
     $output->getFormatter()->setStyle('lvl4', new ColorOutputFormatterStyle('lvl4'));
     $matrix = $this->getMatrix();
     $counts = $this->getCommitCounts($matrix);
     $q1 = $counts[intval(count($counts) / 4)];
     $q2 = $counts[intval(count($counts) / 2)];
     $q3 = $counts[intval(count($counts) * 3 / 4)];
     $output->writeln("╔" . str_repeat("═", count($matrix) / 7 * 2 + 5) . "╗");
     $output->writeln("║ " . $this->getMonthsHeader($matrix) . " ║");
     for ($weekday = 1; $weekday <= 7; $weekday++) {
         $weekdayModulus = $weekday == 7 ? 0 : $weekday;
         $days = [];
         foreach ($matrix as $dayNumber => $day) {
             if ($dayNumber % 7 == $weekdayModulus) {
                 $days[] = $this->getBlock($day['commits'], $q1, $q2, $q3);
             }
         }
         $output->writeln("║ " . $this->getWeekdayName($weekday - 1) . " " . implode(' ', $days) . " ║");
     }
     $output->writeln("║" . str_repeat(" ", count($matrix) / 7 * 2 + 5) . "║");
     $output->writeln("║" . $this->getLegend(count($matrix) / 7 * 2 + 5) . "║");
     $output->writeln("╚" . str_repeat("═", count($matrix) / 7 * 2 + 5) . "╝");
 }
开发者ID:arnaslu,项目名称:repo-stats,代码行数:29,代码来源:Calendar.php

示例2: run

 /**
  * Executes the application.
  *
  * Available options:
  *
  *  * interactive:               Sets the input interactive flag
  *  * decorated:                 Sets the output decorated flag
  *  * verbosity:                 Sets the output verbosity flag
  *  * capture_stderr_separately: Make output of stdOut and stdErr separately available
  *
  * @param array $input   An array of arguments and options
  * @param array $options An array of options
  *
  * @return int The command exit code
  */
 public function run(array $input, $options = array())
 {
     $this->input = new ArrayInput($input);
     if (isset($options['interactive'])) {
         $this->input->setInteractive($options['interactive']);
     }
     $this->captureStreamsIndependently = array_key_exists('capture_stderr_separately', $options) && $options['capture_stderr_separately'];
     if (!$this->captureStreamsIndependently) {
         $this->output = new StreamOutput(fopen('php://memory', 'w', false));
         if (isset($options['decorated'])) {
             $this->output->setDecorated($options['decorated']);
         }
         if (isset($options['verbosity'])) {
             $this->output->setVerbosity($options['verbosity']);
         }
     } else {
         $this->output = new ConsoleOutput(isset($options['verbosity']) ? $options['verbosity'] : ConsoleOutput::VERBOSITY_NORMAL, isset($options['decorated']) ? $options['decorated'] : null);
         $errorOutput = new StreamOutput(fopen('php://memory', 'w', false));
         $errorOutput->setFormatter($this->output->getFormatter());
         $errorOutput->setVerbosity($this->output->getVerbosity());
         $errorOutput->setDecorated($this->output->isDecorated());
         $reflectedOutput = new \ReflectionObject($this->output);
         $strErrProperty = $reflectedOutput->getProperty('stderr');
         $strErrProperty->setAccessible(true);
         $strErrProperty->setValue($this->output, $errorOutput);
         $reflectedParent = $reflectedOutput->getParentClass();
         $streamProperty = $reflectedParent->getProperty('stream');
         $streamProperty->setAccessible(true);
         $streamProperty->setValue($this->output, fopen('php://memory', 'w', false));
     }
     return $this->statusCode = $this->application->run($this->input, $this->output);
 }
开发者ID:Ener-Getick,项目名称:symfony,代码行数:47,代码来源:ApplicationTester.php

示例3: addStyles

 public function addStyles(OutputInterface $output)
 {
     $style = new OutputFormatterStyle('white', 'green', ['bold']);
     $output->getFormatter()->setStyle('notice', $style);
     $style = new OutputFormatterStyle(null, null, ['bold']);
     $output->getFormatter()->setStyle('bold', $style);
 }
开发者ID:neronmoon,项目名称:Codeception,代码行数:7,代码来源:Style.php

示例4: outputFormatterEscape

 protected function outputFormatterEscape($message)
 {
     if ($this->output) {
         return $this->output->getFormatter()->escape($message);
     }
     return $message;
 }
开发者ID:robmachado,项目名称:sped-console,代码行数:7,代码来源:XsdGeneratePhp.php

示例5: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->getFormatter()->setStyle('red', new OutputFormatterStyle('red'));
     $output->getFormatter()->setStyle('cyan', new OutputFormatterStyle('cyan'));
     $output->getFormatter()->setStyle('green', new OutputFormatterStyle('green'));
     $output->getFormatter()->setStyle('magenta', new OutputFormatterStyle('magenta'));
     $this->progress = new ProgressBar($output);
     $this->progress->setFormat('Archiving <cyan>%current%</cyan> files [<green>%bar%</green>] %elapsed:6s% %memory:6s%');
     $name = basename($this->source);
     $dir = dirname($this->source);
     $date = date('YmdHis', time());
     $filename = $name . '-' . $date . '.zip';
     $destination = $input->getArgument('destination') ? $input->getArgument('destination') : ROOT_DIR;
     $destination = rtrim($destination, DS) . DS . $filename;
     $output->writeln('');
     $output->writeln('Creating new Backup "' . $destination . '"');
     $this->progress->start();
     $zip = new \ZipArchive();
     $zip->open($destination, \ZipArchive::CREATE);
     $zip->addEmptyDir($name);
     $this->folderToZip($this->source, $zip, strlen($dir . DS), $this->progress);
     $zip->close();
     $this->progress->finish();
     $output->writeln('');
     $output->writeln('');
 }
开发者ID:miguelramos,项目名称:grav,代码行数:26,代码来源:BackupCommand.php

示例6: execute

 /**
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->destination = $input->getArgument('destination');
     $this->input = $input;
     $this->output = $output;
     // Create a red output option
     $this->output->getFormatter()->setStyle('red', new OutputFormatterStyle('red'));
     $this->output->getFormatter()->setStyle('cyan', new OutputFormatterStyle('cyan'));
     $this->output->getFormatter()->setStyle('magenta', new OutputFormatterStyle('magenta'));
     // Symlink the Core Stuff
     if ($input->getOption('symlink')) {
         // Create Some core stuff if it doesn't exist
         $this->createDirectories();
         // Loop through the symlink mappings and create the symlinks
         $this->symlink();
         // Copy the Core STuff
     } else {
         // Create Some core stuff if it doesn't exist
         $this->createDirectories();
         // Loop through the symlink mappings and copy what otherwise would be symlinks
         $this->copy();
     }
     $this->pages();
     $this->initFiles();
     $this->perms();
 }
开发者ID:re-pe,项目名称:grav,代码行数:32,代码来源:SandboxCommand.php

示例7: execute

 /**
  * execute api command
  *
  * @param \Symfony\Component\Console\Input\InputInterface   $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $aData = array();
     // set colors and formats
     $oErrStyle = new OutputFormatterStyle('red', null, array('bold'));
     $oOkStyle = new OutputFormatterStyle('green', null, array('bold'));
     $oLogoStyle = new OutputFormatterStyle('cyan', null);
     $output->getFormatter()->setStyle('err', $oErrStyle);
     $output->getFormatter()->setStyle('ok', $oOkStyle);
     $output->getFormatter()->setStyle('sw', $oLogoStyle);
     // print logo
     $this->_printLogo($output);
     // Get active remote apps
     $aRemoteApps = RemoteAppQuery::create()->findByActivated(true);
     /** @var RemoteApp $oRemoteApp */
     $iCnt = 0;
     foreach ($aRemoteApps as $oRemoteApp) {
         // get cron string
         $aData[] = array($oRemoteApp->getId(), $oRemoteApp->getName(), $oRemoteApp->getLastRun()->format("d.m.Y H:i:s"));
         $iCnt++;
     }
     // get tablehelper for cli
     $oTable = $this->getHelper('table');
     $oTable->setHeaders(array('ID', 'Title', 'Lastrun'))->setRows($aData);
     $oTable->render($output);
     // green text
     $output->writeln("\n<fg=white;options=bold>     " . $iCnt . " Job(s) found</fg=white;options=bold>\n");
 }
开发者ID:slashworks,项目名称:control-bundle,代码行数:36,代码来源:RemoteAppCommand.php

示例8: initStyle

 private function initStyle(OutputInterface $output)
 {
     $style = new OutputFormatterStyle('black', 'black');
     $output->getFormatter()->setStyle('blackc', $style);
     $style = new OutputFormatterStyle('white', 'white');
     $output->getFormatter()->setStyle('whitec', $style);
 }
开发者ID:jae-jae,项目名称:php-console-qrcode,代码行数:7,代码来源:ConvertCommand.php

示例9: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (info()->installMode()) {
         die('Opis Colibri is not installed' . PHP_EOL);
     }
     $output->getFormatter()->setStyle('b-error', new OutputFormatterStyle('white', 'red', array('bold')));
     $output->getFormatter()->setStyle('warning', new OutputFormatterStyle('yellow'));
     $output->getFormatter()->setStyle('b-warning', new OutputFormatterStyle('yellow', null, array('bold')));
     $output->getFormatter()->setStyle('b-info', new OutputFormatterStyle('green', null, array('bold')));
     $modules = $input->getArgument('module');
     foreach ($modules as $moduleName) {
         $module = module($moduleName);
         if (!$module->exists()) {
             $output->writeln('<error>Module <b-error>' . $moduleName . '</b-error> doesn\'t exist.</error>');
             continue;
         }
         if (!$module->isInstalled()) {
             $output->writeln('<warning>Module <b-warning>' . $moduleName . '</b-warning> is already uninstaled.</warning>');
             continue;
         }
         if ($module->isHidden()) {
             $output->writeln('<error>Module <b-error>' . $moduleName . '</b-error> is hidden and can\'t be uninstalled.');
             continue;
         }
         if ($module->uninstall()) {
             $output->writeln('<info>Module <b-info>' . $moduleName . '</b-info> was uninstalled.</info>');
         } else {
             $output->writeln('<error>Module <b-error>' . $moduleName . '</b-error> could not be uninstalled.</error>');
         }
     }
 }
开发者ID:opis-colibri,项目名称:commands,代码行数:31,代码来源:ModuleUninstallCommand.php

示例10: __construct

 /**
  * Initializes printer.
  *
  * @param OutputInterface     $output
  * @param TranslatorInterface $translator
  */
 public function __construct(OutputInterface $output, TranslatorInterface $translator)
 {
     $this->output = $output;
     $this->translator = $translator;
     $output->getFormatter()->setStyle('snippet_keyword', new OutputFormatterStyle(null, null, array('bold')));
     $output->getFormatter()->setStyle('snippet_undefined', new OutputFormatterStyle('yellow'));
 }
开发者ID:OverByThere,项目名称:Behat,代码行数:13,代码来源:ConsoleSnippetPrinter.php

示例11: __construct

 /**
  * Constructor
  *
  * @param OutputInterface $output
  */
 public function __construct(OutputInterface $output)
 {
     $this->console = $output;
     $outputFormatter = $this->console->getFormatter();
     $outputFormatter->setStyle('detail', new OutputFormatterStyle('blue'));
     $outputFormatter->setStyle('metadata', new OutputFormatterStyle('cyan'));
 }
开发者ID:opexsw,项目名称:magento2,代码行数:12,代码来源:ConsoleLogger.php

示例12: initialize

 /**
  * @see parent::initialize()
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     $style = new OutputFormatterStyle('blue', null, array('bold'));
     $output->getFormatter()->setStyle('b', $style);
     $style = new OutputFormatterStyle(null, 'red', array('bold'));
     $output->getFormatter()->setStyle('error', $style);
 }
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:10,代码来源:MediboardCommand.class.php

示例13: describeRule

 /**
  * Display rule description
  *
  * @param  RuleInterface   $rule
  * @param  OutputInterface $output
  * @return void
  */
 public function describeRule(RuleInterface $rule, OutputInterface $output)
 {
     $output->getFormatter()->setStyle('strong', new OutputFormatterStyle(null, null, ['bold', 'reverse']));
     $output->getFormatter()->setStyle('em', new OutputFormatterStyle('yellow', null, ['bold']));
     $output->getFormatter()->setStyle('code', new OutputFormatterStyle('green'));
     $output->writeln("<strong>{$rule->getName()}</strong>\n");
     $output->writeln("{$rule->getLongDescription()}\n");
 }
开发者ID:t-ichihara,项目名称:parse,代码行数:15,代码来源:RulesCommand.php

示例14: __construct

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @param HelperSet $helperSet
  */
 public function __construct(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
 {
     $this->input = $input;
     $this->output = $output;
     $this->helperSet = $helperSet;
     $this->output->getFormatter()->setStyle('header', new OutputFormatterStyle('yellow', null, array('bold')));
     $this->output->getFormatter()->setStyle('question', new OutputFormatterStyle('yellow', null, array('bold')));
 }
开发者ID:jenswiese,项目名称:phpteda,代码行数:13,代码来源:ConsoleIO.php

示例15: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->input = $input;
     $this->output = $output;
     // Configure extra output formats
     $this->output->getFormatter()->setStyle('bold', new OutputFormatterStyle('blue'));
     $this->fire();
 }
开发者ID:silverstripe,项目名称:cow,代码行数:11,代码来源:Command.php


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