src/Scenario/ConsoleProgressBarTrait.php
public function preRun(): void {
    if ($output = $this->getOutput()) {
      $max = 0;
      $iterator = $this->getIterator();

      if ($iterator instanceof \SplFileObject) {
        $max = $iterator->getSize();
      }
      elseif ($iterator instanceof \Countable) {
        $max = count($iterator);
      }

      $this->progress = new ProgressBar($output, $max);
      if ($output->isDecorated()) {
        // If output is not decorated, the redraw frequency would automatically
        // be set to $max/10 by default.
        $this->progress->setRedrawFrequency($max / 100);
      }
      $this->progress->start();
    }
  }
public function preRun(): void {
    if ($output = $this->getOutput()) {
      $max = 0;
      $iterator = $this->getIterator();

      if ($iterator instanceof \SplFileObject) {
        $max = $iterator->getSize();
      }
      elseif ($iterator instanceof \Countable) {
        $max = count($iterator);
      }

      $this->progress = new ProgressBar($output, $max);
      if ($output->isDecorated()) {
        // If output is not decorated, the redraw frequency would automatically
        // be set to $max/10 by default.
        $this->progress->setRedrawFrequency($max / 100);
      }
      $this->progress->start();
    }
  }
public function preRun ( ) : void { if ( $ output = $ this -> getOutput ( ) ) { $ max = 0 ; $ iterator = $ this -> getIterator ( ) ; if ( $ iterator instanceof \ SplFileObject ) { $ max = $ iterator -> getSize ( ) ; } elseif ( $ iterator instanceof \ Countable ) { $ max = count ( $ iterator ) ; } $ this -> progress = new ProgressBar ( $ output , $ max ) ; if ( $ output -> isDecorated ( ) ) { // If output is not decorated, the redraw frequency would automatically // be set to $max/10 by default. $ this -> progress -> setRedrawFrequency ( $ max / 100 ) ; } $ this -> progress -> start ( ) ; } }
Starts a new progress bar output in the pre-run phase.

@see \Shiyan\Iterate\Scenario\ScenarioInterface::preRun()
Starts a new progress bar output in the pre - run phase .