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


PHP ProgressBar::getStartTime方法代码示例

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


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

示例1: progressAdvance

 /**
  * @phpcsSuppress SlevomatCodingStandard.Typehints.TypeHintDeclaration.missingParameterTypeHint
  * @param int $step
  */
 public function progressAdvance($step = 1)
 {
     if ($this->output->isDecorated() && $step > 0) {
         $stepTime = (time() - $this->progressBar->getStartTime()) / $step;
         if ($stepTime > 0 && $stepTime < 1) {
             $this->progressBar->setRedrawFrequency(1 / $stepTime);
         } else {
             $this->progressBar->setRedrawFrequency(1);
         }
     }
     $this->progressBar->setProgress($this->progressBar->getProgress() + $step);
 }
开发者ID:phpstan,项目名称:phpstan,代码行数:16,代码来源:ErrorsConsoleStyle.php

示例2: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $pBar = new ProgressBar($output, 10);
     $pBar->start();
     $showOutput = false;
     try {
         $sugarKernel = new SugarKernel('cli', 'dev', false);
         $sugarKernel->boot();
     } catch (\Exception $e) {
         $output->writeln($e->getMessage());
     }
     $pBar->advance(2);
     /** @var \User $user */
     $user = $sugarKernel->getG('current_user');
     $user->getSystemUser();
     $modules = $sugarKernel->getG('mod_strings');
     $pBar->advance();
     $qrr = new Qrr();
     if ($input->getOption('yell')) {
         $showOutput = true;
         $output->writeln('QRR output: ');
     }
     $qrr->repairAndClearAll(['clearAll'], [$modules['LBL_ALL_MODULES']], true, $showOutput);
     $pBar->advance(5);
     $sugarKernel->shutdown();
     $pBar->finish();
     $elapsed = time() - $pBar->getStartTime();
     $output->writeln(' ');
     $output->writeln(" Executed in: {$elapsed} s");
 }
开发者ID:svnvcristea,项目名称:pslib,代码行数:30,代码来源:QRRCommand.php

示例3: download

 /**
  * @param \FlickrDownloadr\Photo\Photo $photo
  * @param string $filename
  * @param string $dirname
  * @return int Number of bytes that were written to the file, or FALSE on failure
  */
 public function download(Photo $photo, $filename, $dirname)
 {
     $url = $photo->getUrl();
     if ($this->dryRun) {
         return 0;
     }
     \Nette\Utils\FileSystem::createDir($dirname . '/' . dirname($filename));
     $this->setupProgressBar();
     $ctx = stream_context_create();
     stream_context_set_params($ctx, array("notification" => $this->getNotificationCallback($filename)));
     $bytes = file_put_contents($dirname . '/' . $filename, fopen($url, 'r', FALSE, $ctx));
     if ($bytes === FALSE) {
         $this->progress->setMessage('<error>Error!</error>', 'final_report');
     } else {
         list($time, $size, $speed) = $this->getFinalStats($this->progress->getMaxSteps(), $this->progress->getStartTime());
         $this->progress->setMessage('<comment>[' . $size . ' in ' . $time . ' (' . $speed . ')]</comment>', 'final_report');
         $this->progress->setFormat('%message% %final_report%' . "\n");
     }
     $this->progress->finish();
     $this->output->writeln('');
     return $bytes;
 }
开发者ID:michalsanger,项目名称:cli-flickr-downloadr,代码行数:28,代码来源:Downloader.php

示例4: testSetCurrentBeforeStarting

 /**
  */
 public function testSetCurrentBeforeStarting()
 {
     $bar = new ProgressBar($this->getOutputStream());
     $bar->setProgress(15);
     $this->assertNotNull($bar->getStartTime());
 }
开发者ID:saj696,项目名称:pipe,代码行数:8,代码来源:ProgressBarTest.php

示例5: reDrawProgressBar

 public function reDrawProgressBar()
 {
     if ($this->progress !== null && $this->progress->getStartTime() !== null) {
         $this->progress->display();
     }
 }
开发者ID:noikiy,项目名称:php-to-zephir,代码行数:6,代码来源:Logger.php

示例6: reDrawProgressBar

 public function reDrawProgressBar()
 {
     if ($this->progress !== null && $this->progress->getStartTime() !== null && $this->progress->getProgress() !== $this->progress->getMaxSteps() && $this->progresseBar === true) {
         $this->progress->display();
     }
 }
开发者ID:woshigehaoren,项目名称:php-to-zephir,代码行数:6,代码来源:Logger.php


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