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