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


PHP SymfonyStyle::write方法代码示例

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


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

示例1: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output = new SymfonyStyle($input, $output);
     $workerCount = $input->getOption('count');
     $queues = $this->createQueues($input->getArgument('queues'));
     $output->write($queues);
     // This method of worker setup requires an array of queues
     if (!is_array($queues)) {
         throw new \Exception("Queues not initialized correctly");
     }
     $workers = array();
     for ($i = 0; $i < $workerCount; ++$i) {
         $worker = $this->workerFactory->createWorker();
         $workerProcess = $this->workerFactory->createWorkerProcess($worker);
         foreach ($queues as $queue) {
             $worker->addQueue($queue);
         }
         $workers[] = $workerProcess;
     }
     $this->foreman->pruneDeadWorkers();
     $this->foreman->work($workers, $input->getOption('wait'));
     echo sprintf('%d workers attached to the %s queues successfully started.', count($workers), implode($queues, ','));
     //        echo sprintf(
     //            'Workers (%s)',
     //            implode(', ', $workers)
     //        );
 }
开发者ID:php-resque,项目名称:resque-bundle,代码行数:27,代码来源:WorkerStartCommand.php

示例2: function

<?php

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
// Ensure has proper line ending before outputing a text block like with SymfonyStyle::listing() or SymfonyStyle::text()
return function (InputInterface $input, OutputInterface $output) {
    $output = new SymfonyStyle($input, $output);
    $output->writeln('Lorem ipsum dolor sit amet');
    $output->listing(array('Lorem ipsum dolor sit amet', 'consectetur adipiscing elit'));
    // Even using write:
    $output->write('Lorem ipsum dolor sit amet');
    $output->listing(array('Lorem ipsum dolor sit amet', 'consectetur adipiscing elit'));
    $output->write('Lorem ipsum dolor sit amet');
    $output->text(array('Lorem ipsum dolor sit amet', 'consectetur adipiscing elit'));
};
开发者ID:ngitimfoyo,项目名称:Nyari-AppPHP,代码行数:16,代码来源:command_5.php

示例3: function

<?php

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
//Ensure has single blank line after any text and a title
return function (InputInterface $input, OutputInterface $output) {
    $output = new SymfonyStyle($input, $output);
    $output->write('Lorem ipsum dolor sit amet');
    $output->title('First title');
    $output->writeln('Lorem ipsum dolor sit amet');
    $output->title('Second title');
    $output->write('Lorem ipsum dolor sit amet');
    $output->write('');
    $output->title('Third title');
    //Ensure edge case by appending empty strings to history:
    $output->write('Lorem ipsum dolor sit amet');
    $output->write(array('', '', ''));
    $output->title('Fourth title');
    //Ensure have manual control over number of blank lines:
    $output->writeln('Lorem ipsum dolor sit amet');
    $output->writeln(array('', ''));
    //Should append an extra blank line
    $output->title('Fifth title');
    $output->writeln('Lorem ipsum dolor sit amet');
    $output->newLine(2);
    //Should append an extra blank line
    $output->title('Fifth title');
};
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:29,代码来源:command_4.php

示例4: write

 /**
  * @param $symbol
  */
 private function write($symbol)
 {
     $this->io->note('Symbol to draw');
     $this->io->write(AsciiHelper::renderSymbol($symbol));
     $this->gitProcessor->writeSymbol($symbol, $this->lastSunday);
 }
开发者ID:lucascherifi,项目名称:gitaski,代码行数:9,代码来源:GitAski.php

示例5: checkBackup

 /**
  * Check single backup-configuration.
  *
  * @param PluginRegistry $plugins
  * @param SymfonyStyle $io
  * @param string $name
  * @param array $backup
  *
  * @return bool
  */
 private function checkBackup(PluginRegistry $plugins, SymfonyStyle $io, $name, array $backup)
 {
     $io->section('Backup: ' . $name);
     if (!$plugins->has($backup['plugin'])) {
         $io->warning(sprintf('Plugin "%s" not found', $backup['plugin']));
         return false;
     }
     $optionsResolver = new OptionsResolver();
     $plugins->getPlugin($backup['plugin'])->configureOptionsResolver($optionsResolver);
     try {
         $parameter = $optionsResolver->resolve($backup['parameter']);
     } catch (InvalidArgumentException $e) {
         $io->warning(sprintf('Parameter not valid' . PHP_EOL . PHP_EOL . 'Message: "%s"', $e->getMessage()));
         return false;
     }
     $io->write('Parameter:');
     $messages = array_filter(explode("\r\n", Yaml::dump($parameter)));
     $io->block($messages, null, null, '  ');
     $io->writeln('OK');
     return true;
 }
开发者ID:nanbando,项目名称:core,代码行数:31,代码来源:CheckCommand.php


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