本文整理汇总了PHP中Symfony\Component\Console\Helper\ProgressBar::setBarCharacter方法的典型用法代码示例。如果您正苦于以下问题:PHP ProgressBar::setBarCharacter方法的具体用法?PHP ProgressBar::setBarCharacter怎么用?PHP ProgressBar::setBarCharacter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Helper\ProgressBar
的用法示例。
在下文中一共展示了ProgressBar::setBarCharacter方法的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: logTask
/**
* @param string $message
*/
public function logTask($message)
{
$this->clearLine();
$this->output->writeln('<fg=blue;options=bold> > ' . $message . " </fg=blue;options=bold>");
if ($this->output->getVerbosity() <= OutputInterface::VERBOSITY_NORMAL) {
$this->progress = new ProgressBar($this->output);
$this->progress->setEmptyBarCharacter(' ');
$this->progress->setBarCharacter('-');
$this->progress->start();
}
}
示例10: 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;
}
示例11: 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;
}
示例12: getProgressBar
protected function getProgressBar($nbIteration, $message)
{
$bar = new ProgressBar($this->output, $nbIteration);
ProgressBar::setPlaceholderFormatterDefinition('memory', function (ProgressBar $bar) {
static $i = 0;
$mem = memory_get_usage();
$colors = $i++ ? '41;37' : '44;37';
return "[" . $colors . 'm ' . Helper::formatMemory($mem) . " [0m";
});
$bar->setFormat(" [44;37m %title:-38s% [0m\n %current%/%max% %bar% %percent:3s%%\n 🏁 %remaining:-10s% %memory:37s%\n");
$bar->setBarCharacter("[32m●[0m");
$bar->setEmptyBarCharacter("[31m●[0m");
$bar->setMessage($message, 'title');
$bar->start();
return $bar;
}
示例13: 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();
}
示例14: 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();
}
}
示例15: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
/** @var FormatterHelper $formatter */
$formatter = $this->getHelper('formatter');
$message = $formatter->formatSection('Section', 'Hello!', 'comment');
$output->writeln($message);
$blockMessage = $formatter->formatBlock(['Good luck!'], 'bg=black;fg=white', true);
$output->writeln($blockMessage);
/** @var ProcessHelper $processHelper */
$processHelper = $this->getHelper('process');
$process = ProcessBuilder::create(['figlet', 'Started!'])->getProcess();
$processHelper->run($output, $process, 'Something went wrong');
$finder = new Finder();
$files = $finder->in(CACHE_PATH)->name('makes*json')->files();
$progressHelper = new ProgressBar($output);
$progressHelper->setEmptyBarCharacter('.');
$progressHelper->setBarCharacter('<comment>+</comment>');
if ($input->getOption('progress')) {
$progressHelper->start($files->count());
}
$table = new Table($output);
$table->setStyle('default');
$style = new TableStyle();
$style->setBorderFormat('<comment>%s</comment>');
$table->setStyle($style);
foreach ($files as $file) {
/** @var SplFileInfo $file */
$makes = json_decode($file->getContents(), true);
$table->setHeaders(['Make Name', 'Models Count']);
foreach ($makes['makes'] as $make) {
$table->addRow([$make['name'], count($make['models'])]);
}
// $table->render($output);
if ($input->getOption('progress')) {
$progressHelper->advance();
}
}
if ($input->getOption('progress')) {
$progressHelper->finish();
$output->writeln('');
}
}
开发者ID:GrizliK1988,项目名称:symfony-certification-prepare-project,代码行数:42,代码来源:MakesCacheReportCommand.php