本文整理汇总了PHP中Symfony\Component\Console\Helper\ProgressBar::setProgressCharacter方法的典型用法代码示例。如果您正苦于以下问题:PHP ProgressBar::setProgressCharacter方法的具体用法?PHP ProgressBar::setProgressCharacter怎么用?PHP ProgressBar::setProgressCharacter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Helper\ProgressBar
的用法示例。
在下文中一共展示了ProgressBar::setProgressCharacter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: progressBarInit
private function progressBarInit($count)
{
if ($this->progressBar === null) {
return;
}
$this->progressBar->start($count);
$this->progressBar->setBarCharacter(Constants::CHARACTER_PROGRESS_BAR);
$this->progressBar->setProgressCharacter(Constants::CHARACTER_BEER);
}
示例2: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
/** @var ImportAddressService $importAddressService */
$importAddressService = $this->getHelper('container')->getByType('StreetApi\\Services\\ImportAddressService');
$cityId = $input->getArgument('cityId');
$xmlFile = simplexml_load_file($importAddressService->getRootDir() . '/../adresy.xml');
if (!$xmlFile) {
$output->writeln(PHP_EOL . '<error>Missing source file!</error>');
return 1;
}
try {
$output->writeLn('<info>Start importing addresses</info>');
$totalCount = $xmlFile->count();
$output->writeln(PHP_EOL . PHP_EOL . PHP_EOL . PHP_EOL);
$progressBar = new ProgressBar($output, $totalCount);
$progressBar->setFormat('%message%' . PHP_EOL . '%bar% %percent:3s% %' . PHP_EOL . 'count: %current%/%max%' . PHP_EOL . 'time: %elapsed:6s%/%estimated:-6s%' . PHP_EOL);
$progressBar->setBarCharacter('<info>■</info>');
$progressBar->setEmptyBarCharacter(' ');
$progressBar->setProgressCharacter('');
$progressBar->setRedrawFrequency(ceil($totalCount / 100));
$progressBar->start();
$importAddressService->import($xmlFile, $progressBar, $cityId);
$output->writeLn(PHP_EOL . '<info>Importing addresses finished</info>');
return 0;
} catch (\Exception $e) {
$output->writeLn('<error>' . $e->getMessage() . '</error>');
return 1;
}
}
示例3: createProgressBar
/**
* @param OutputInterface $output
* @return ProgressBar
*/
protected function createProgressBar(OutputInterface $output)
{
$progress = new ProgressBar($output);
$progress->setBarCharacter('<comment>=</comment>');
$progress->setProgressCharacter('|');
$progress->setFormat(self::PROGRESS_BAR_MESSAGE_FORMAT);
return $progress;
}
示例4: getProgress
/**
* Progress bar define
*
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @param int $finish
* @param string $format
* @return \Symfony\Component\Console\Helper\ProgressBar
*/
public function getProgress(OutputInterface $output, $finish = 100, $format = 'normal')
{
$progress = new ProgressBar($output, $finish);
$progress->setProgressCharacter('ϟ');
$progress->setFormat($format);
$progress->setBarCharacter('<comment>=</comment>');
return $progress;
}
示例5: createProgressBar
/**
* @param OutputInterface $output
* @param int $length
*
* @return ProgressBar
*/
protected function createProgressBar(OutputInterface $output, $length = 10)
{
$progress = new ProgressBar($output);
$progress->setBarCharacter('<info>|</info>');
$progress->setEmptyBarCharacter(' ');
$progress->setProgressCharacter('|');
$progress->start($length);
return $progress;
}
示例6: setupProgressBar
/**
* Setup the progress bar.
*
* @param \Symfony\Component\Console\Output\OutputInterface $output
*/
protected function setupProgressBar(OutputInterface $output)
{
$this->progress = new ProgressBar($output, count($this->themes) * count($this->patterns));
$this->progress->setFormat("<info>%message%</info>\n<fg=red>[</>%bar%<fg=red>]</> <fg=yellow>(%current%/%max%) (%elapsed%)</>");
$this->progress->setBarCharacter('<fg=blue>#</>');
$this->progress->setProgressCharacter("<fg=magenta>#</>");
$this->progress->setMessage('Test');
$this->progress->start();
}
示例7: create
public static function create(OutputInterface $output)
{
$bar = new ProgressBar($output);
$bar->setBarCharacter('<fg=green>=</>');
$bar->setEmptyBarCharacter('<fg=red>=</>');
$bar->setProgressCharacter('>');
$bar->setBarWidth(40);
$bar->setFormat("%message%\n [%bar%] %percent:3s%%\n%elapsed:6s%/%estimated:-6s% %memory:6s%\n");
return $bar;
}
示例8: getProgressBar
/**
* @param OutputInterface $output
*
* @return \Symfony\Component\Console\Helper\ProgressBar
*/
private function getProgressBar(OutputInterface $output)
{
$bar = new ProgressBar($output);
$bar->setFormat(' %current%/%max% [%bar%] %percent:3s%% %memory:6s%');
$bar->setBarCharacter('<comment>=</comment>');
$bar->setEmptyBarCharacter(' ');
$bar->setProgressCharacter('|');
$bar->setBarWidth(50);
return $bar;
}
示例9: barSetup
/**
* Setting custom formatting for the progress bar
* @param object $bar Symfony ProgressBar instance
* @return object $bar Symfony ProgressBar instance
*/
public function barSetup(ProgressBar $bar)
{
// the finished part of the bar
$bar->setBarCharacter('<comment>=</comment>');
// the unfinished part of the bar
$bar->setEmptyBarCharacter('-');
// the progress character
$bar->setProgressCharacter('>');
// the 'layout' of the bar
$bar->setFormat(' %current%/%max% [%bar%] %percent:3s%% ');
return $bar;
}
示例10: build
/**
* @return \Symfony\Component\Console\Helper\ProgressBar
*/
public function build()
{
$this->setupFormat();
$progressBar = new ProgressBar($this->output, $this->count);
$progressBar->setMessage($this->barTitle, 'barTitle');
$progressBar->setBarWidth(20);
if ($this->output->getVerbosity() > OutputInterface::VERBOSITY_VERBOSE) {
$progressBar->setBarCharacter("[32m◼[0m");
$progressBar->setEmptyBarCharacter("[31m◼[0m");
$progressBar->setProgressCharacter("[32m▶[0m");
$progressBar->setBarWidth(50);
}
return $progressBar;
}
示例11: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$rows = 100;
$progressBar = new ProgressBar($output, $rows);
$progressBar->setBarCharacter('<comment>=</comment>');
$progressBar->setProgressCharacter('>');
$progressBar->setBarWidth(77);
$table = new Table($output);
for ($i = 0; $i < $rows; $i++) {
$table->addRow([sprintf('Row <info># %s</info>', $i), rand(0, 1000)]);
usleep(50000);
$progressBar->advance();
}
$progressBar->finish();
$output->writeln('');
$table->render();
}
示例12: set_task_count
/**
* {@inheritdoc}
*/
public function set_task_count($task_count, $restart = false)
{
parent::set_task_count($task_count, $restart);
if ($this->output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL) {
$this->progress_bar = $this->io->createProgressBar($task_count);
$this->progress_bar->setFormat(" %current:3s%/%max:-3s% %bar% %percent:3s%%\n" . " %message%\n");
$this->progress_bar->setBarWidth(60);
if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
$this->progress_bar->setEmptyBarCharacter('░');
// light shade character \u2591
$this->progress_bar->setProgressCharacter('');
$this->progress_bar->setBarCharacter('▓');
// dark shade character \u2593
}
$this->progress_bar->setMessage('');
$this->io->newLine(2);
$this->progress_bar->start();
}
}
示例13: onStart
/**
* @param array $data
*/
protected function onStart(array $data)
{
$format = isset($this->options['format']) ? $this->options['format'] : 'normal';
if (isset($data['total']) && $data['total'] > 0) {
$maxSteps = (int) $data['total'];
unset($data['total']);
} else {
$maxSteps = 1;
}
$progress = new ProgressBar($this->output, $maxSteps);
$progress->setFormat($format);
$progress->setEmptyBarCharacter(' ');
$progress->setProgressCharacter(':');
foreach ($data as $key => $value) {
$progress->setMessage($value, $key);
}
$progress->start();
$this->progress = $progress;
}
示例14: execute
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
try {
$verbosityLevelMap = array(LogLevel::NOTICE => OutputInterface::VERBOSITY_NORMAL, LogLevel::INFO => OutputInterface::VERBOSITY_NORMAL);
$logger = new ConsoleLogger($output, $verbosityLevelMap);
$progressBar = new ProgressBar($output);
$progressBar->setFormat("<info>[info] %message% : %current%/%max% [</info>%bar%<info>] %percent:3s%% %elapsed:6s%/%estimated:-6s%</info>");
$progressBar->setEmptyBarCharacter('<fg=red>-</>');
$progressBar->setBarCharacter('<info>=</info>');
$progressBar->setProgressCharacter('<info>></info>');
$output->writeln("\n\r<question>Execution de la passerelle JLP-IMMO</question>");
// Appel du service correpondant au CRON
$services = $this->getContainer()->get('jlp_core.passerelle');
$responseServices = $services->execute($logger, $progressBar);
$output->writeln("<info>Passerelle resultat : " . print_r($responseServices, true) . "</info>");
$output->writeln("\n\r");
} catch (\Exception $e) {
$output->writeln("\t<error>Passerelle Exception : " . $e . '</error>');
}
}
示例15: createProgressBar
private function createProgressBar($max = 100)
{
$bar = new ProgressBar($this->output, $max);
$bar->setBarCharacter('<info>#</info>');
$bar->setProgressCharacter('<info>#</info>');
$bar->setFormat("%message%\n" . '%percent:3s%% [%bar%] %elapsed:6s%/%estimated:-6s% ');
return $bar;
}