Symfony\Component\Console\Helper\ProgressBar::start PHP Method

start() public method

Starts the progress output.
public start ( integer | null $max = null )
$max integer | null Number of steps to complete the bar (0 if indeterminate), null to leave unchanged
    public function start($max = null)
    {
        $this->startTime = time();
        $this->step = 0;
        $this->percent = 0.0;
        if (null !== $max) {
            $this->setMaxSteps($max);
        }
        $this->display();
    }

Usage Example

コード例 #1
0
 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);
 }
All Usage Examples Of Symfony\Component\Console\Helper\ProgressBar::start