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


PHP ProgressBar::start方法代码示例

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


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

示例1: test

 protected function test($count, $classes, OutputInterface $output)
 {
     $this->table = new Table($output);
     $this->table->setHeaders(array('Implementation', 'Memory', 'Duration'));
     $output->writeln(sprintf('<info>%d elements</info>', $count));
     $this->process = new ProgressBar($output, count($classes));
     $this->process->start();
     foreach ($classes as $class) {
         $shortClass = $class;
         //            if (in_array($class, $blacklist)) {
         //                $this->table->addRow([$class, '--', '--']);
         //                continue;
         //            };
         $path = __DIR__ . '/../../bin/test.php';
         $result = `php {$path} {$class} {$count}`;
         $data = json_decode($result, true);
         if (!$data) {
             echo $result;
         }
         $this->table->addRow([$shortClass, sprintf('%11sb', number_format($data['memory'])), sprintf('%6.4fs', $data['time'])]);
         $this->process->advance();
     }
     $this->process->finish();
     $output->writeln('');
     $this->table->render($output);
 }
开发者ID:Pandahisham,项目名称:topsort.php,代码行数:26,代码来源:BenchmarkCommand.php

示例2: prepare

 /**
  * {@inheritdoc}
  */
 public function prepare()
 {
     $this->progress = new ProgressBar($this->output, $this->reader->count());
     $this->progress->setFormat($this->verbosity);
     $this->progress->setRedrawFrequency($this->redrawFrequency);
     $this->progress->start();
 }
开发者ID:megamanhxh,项目名称:data-import,代码行数:10,代码来源:ConsoleProgressWriter.php

示例3: start

 /**
  * {@inheritdoc}
  */
 public function start()
 {
     $dispatcher = $this->getDispatcher();
     $sourceEvent = new SourcePipelineEvent();
     $sourceEvent->setContext($this->getContext());
     $dispatcher->dispatch($this->getEventName(self::EVENT_SUFFIX_SOURCE), $sourceEvent);
     $this->setContext($sourceEvent->getContext());
     $sources = $sourceEvent->getSources();
     $outputs = [];
     $startEvent = new StartPipelineEvent();
     $startEvent->setContext($this->getContext());
     $startEvent->setItemCount($this->countSourceItems($sources));
     $dispatcher->dispatch($this->getEventName(self::EVENT_SUFFIX_START), $startEvent);
     $this->setContext($startEvent->getContext());
     $this->progressBar && $this->progressBar->start($this->countSourceItems($sources));
     foreach ($sources as $source) {
         foreach ($source as $item) {
             $itemEvent = new ItemPipelineEvent($item);
             $itemEvent->setContext($this->getContext());
             $dispatcher->dispatch($this->getEventName(self::EVENT_SUFFIX_MODIFY), $itemEvent);
             $dispatcher->dispatch($this->getEventName(self::EVENT_SUFFIX_CONSUME), $itemEvent);
             $output = $itemEvent->getOutput();
             if ($output !== null) {
                 $outputs[] = $output;
             }
             $this->setContext($itemEvent->getContext());
             $this->progressBar && $this->progressBar->advance();
         }
     }
     $finishEvent = new FinishPipelineEvent();
     $finishEvent->setContext($this->getContext());
     $dispatcher->dispatch($this->getEventName(self::EVENT_SUFFIX_FINISH), $finishEvent);
     $this->progressBar && $this->progressBar->finish();
     return ['outputs' => $outputs];
 }
开发者ID:asev,项目名称:ConnectionsBundle,代码行数:38,代码来源:Pipeline.php

示例4: run

 public function run(OutputInterface $output)
 {
     $output->writeln('**********************************');
     $output->writeln('Starting sync for dojos');
     $this->progressBar = $this->newProgressBar($output);
     $externalDojos = $this->zen->getDojos();
     $this->progressBar->start(count($externalDojos));
     $this->progressBar->setMessage('Iterating dojos...');
     foreach ($externalDojos as $externalDojo) {
         $this->progressBar->setMessage('Handling ' . $externalDojo->getName());
         if (true === $externalDojo->isRemoved()) {
             $this->removeInternalDojo($externalDojo);
             continue;
         }
         try {
             $internalDojo = $this->getInternalDojo($externalDojo->getZenId(), $externalDojo->getCity(), $externalDojo->getTwitter(), $externalDojo->getEmail());
         } catch (NonUniqueResultException $exception) {
             $this->unmatched[] = $externalDojo;
             continue;
         }
         if (null !== $internalDojo) {
             $this->updateInternalDojo($internalDojo, $externalDojo);
             continue;
         }
         $this->createDojo($externalDojo);
     }
     $this->progressBar->setMessage('Flushing');
     $this->doctrine->flush();
     $this->progressBar->setMessage('Finished syncing dojos!');
     $this->progressBar->finish();
     $output->writeln($this->countNew . ' New dojos added');
     $output->writeln($this->countUpdated . ' Existing dojos updated');
     $output->writeln($this->countRemoved . ' Existing dojos removed');
     $this->notifySlack();
 }
开发者ID:CoderDojoNederland,项目名称:Website,代码行数:35,代码来源:SyncDojoService.php

示例5: startProgress

 /**
  * @param RunnerEvent $event
  */
 public function startProgress(RunnerEvent $event)
 {
     $numberOftasks = $event->getTasks()->count();
     $this->progressBar->setFormat('<fg=yellow>%message%</fg=yellow>');
     $this->progressBar->setMessage('GrumPHP is sniffing your code!');
     $this->progressBar->start($numberOftasks);
 }
开发者ID:phpro,项目名称:grumphp,代码行数:10,代码来源:ProgressSubscriber.php

示例6: setupProgressBar

 /**
  * @param OutputInterface $output
  * @param Repository $source
  * @param WritableRepository $destination
  */
 private function setupProgressBar(OutputInterface $output, Repository $source, WritableRepository $destination)
 {
     $this->progress = new ProgressBar($output, count($source));
     $this->progress->setMessage('Generating database...');
     $this->progress->start();
     $destination->attach($this);
 }
开发者ID:nick-jones,项目名称:php-ucd,代码行数:12,代码来源:RepositoryTransferCommand.php

示例7: start

 /**
  * Starting the install process.
  *
  * @param string $message  Start message
  * @param int    $maxSteps The number of steps that will be taken
  */
 public function start($message, $maxSteps)
 {
     $this->info($message);
     if ($this->progressBar instanceof ProgressBar) {
         $this->progressBar->setMessage($message);
         $this->progressBar->start($maxSteps);
     }
 }
开发者ID:gjb2048,项目名称:moodle-plugin-ci,代码行数:14,代码来源:InstallOutput.php

示例8: 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);
 }
开发者ID:bitban,项目名称:php-code-quality-tools,代码行数:9,代码来源:HookManager.php

示例9: startProgress

 protected function startProgress($num = 2)
 {
     if (!$this->getOutput()) {
         throw new \Exception('Unable to find console output object.');
     }
     $this->bar = new ProgressBar($this->getOutput(), $num);
     $this->bar->setFormat("%message%\n [%bar%] %percent:3s%% %elapsed% %memory:6s% ");
     $this->bar->start();
 }
开发者ID:humweb,项目名称:slackpipe,代码行数:9,代码来源:ProgressbarTrait.php

示例10: start

 /**
  * @param int $total
  */
 public function start($total)
 {
     if (!$this->verbose) {
         return;
     }
     $format = $this->label . ': <comment>loading %max% files into memory, this can take some time</comment>';
     $this->progressBar->setFormat($format);
     $this->progressBar->start($total);
 }
开发者ID:Soullivaneuh,项目名称:deprecation-detector,代码行数:12,代码来源:VerboseProgressOutput.php

示例11: onPreFetch

 /**
  * @param TransportEvent $event
  */
 public function onPreFetch(TransportEvent $event)
 {
     $size = $event->getTransport()->getSize();
     if ($event->getTransport() instanceof ProgressAwareInterface && $size > 0) {
         $this->progress->start($size);
         $this->progressActive = true;
     }
     $this->progress->setMessage(sprintf('Downloading <info>%s</info> (%s KB)', (string) $event->getTransport(), $size > 0 ? number_format(round($size / 1024), 0, ',', '.') : 'unknown'));
 }
开发者ID:treehouselabs,项目名称:io-bundle,代码行数:12,代码来源:ImportOutputSubscriber.php

示例12: execute

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return null|int null or 0 if everything went fine, or an error code
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $config = Config::getInstance();
     $noProgress = $input->getOption('no-progress');
     $query = $input->getArgument('query');
     $provider = $config->getQuery($query);
     if (empty($provider)) {
         $output->writeln("<error>cannot found query \"{$query}\"</error>");
         $output->writeln("<info>you can execute \"</info>ipv4 edit<info>\" to configure the query</info>");
         return 1;
     }
     $type = $input->getOption('type');
     $filename = $config->getFilename($input->getArgument('filename'));
     $export = ExportQuery::create($type, $filename);
     if (empty($export)) {
         $output->writeln("<error>cannot found export query \"{$type}\"</error>");
         return 2;
     }
     $export->setProviders([$provider]);
     $encoding = $input->getOption('encoding');
     if (!empty($encoding)) {
         $export->setEncoding($encoding);
     }
     $ecdz = $input->getOption('ecdz');
     if ($ecdz && method_exists($export, 'setEcdz')) {
         $export->setEcdz($ecdz);
     }
     $remove_ip_in_recode = $input->getOption('remove-ip-in-recode');
     if ($remove_ip_in_recode && method_exists($export, 'setRemoveIpInRecode')) {
         $export->setRemoveIpInRecode($remove_ip_in_recode);
     }
     $output->writeln("<info>export \"{$query}\" to \"{$type}\" filename \"{$filename}\":</info>");
     if (!$noProgress) {
         $export->init(function ($code, $n) use($output) {
             switch ($code) {
                 case 0:
                     $this->progress = new ProgressBar($output, $n);
                     $this->progress->start();
                     break;
                 case 1:
                     $this->progress->setProgress($n);
                     break;
                 case 2:
                     $this->progress->finish();
                     break;
             }
         });
     } else {
         $export->init();
     }
     $output->writeln('<info> completed!</info>');
     return 0;
 }
开发者ID:larryli,项目名称:ipv4-console,代码行数:58,代码来源:ExportCommand.php

示例13: __invoke

 /**
  * @param string $type
  * @param string $buffer
  */
 public function __invoke(string $type, string $buffer)
 {
     if ($type === 'err' && preg_match('/^-n\\s*\\d+\\s*\\/\\s*(\\d+)\\s*\\((\\d+)\\)\\s*$/', $buffer, $matches)) {
         if ($this->progressBar === null) {
             $this->progressBar = new ProgressBar($this->output, (int) $matches[1]);
             $this->progressBar->setBarWidth(100);
             $this->progressBar->start();
         }
         $this->progressBar->advance();
         $this->updates = $matches[2];
     }
 }
开发者ID:gplanchat,项目名称:grenade,代码行数:16,代码来源:GitSubtreeProgressBarHelper.php

示例14: setDownloadWithProgressBar

 private function setDownloadWithProgressBar()
 {
     $emitter = $this->httpClient->getEmitter();
     $emitter->on('before', function (\GuzzleHttp\Event\BeforeEvent $event) {
         echo $event->getRequest();
     });
     $emitter->once('progress', function (\GuzzleHttp\Event\ProgressEvent $event) {
         $this->progressBar->start($event->downloadSize);
     });
     $emitter->on('progress', function (\GuzzleHttp\Event\ProgressEvent $event) {
         $this->progressBar->setProgress($event->downloaded);
     });
 }
开发者ID:fonsecas72,项目名称:selenium-handler,代码行数:13,代码来源:SeleniumDownloader.php

示例15: invoke

 public function invoke(ElasticPopulator $populator)
 {
     $begin = function ($total) {
         $this->bar = new ProgressBar($this->out, $total);
         $this->bar->start();
     };
     $tick = function () {
         $this->bar->advance();
     };
     $rows = $populator->populate($begin, $tick);
     $this->bar->finish();
     $this->out->write("\n");
     $this->out->writeln("<info>Reindexed {$rows} rows</info>");
 }
开发者ID:VasekPurchart,项目名称:khanovaskola-v3,代码行数:14,代码来源:Populate.php


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