本文整理汇总了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)
// );
}
示例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'));
};
示例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');
};
示例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);
}
示例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;
}