You are here

public function ProgressBar::__construct in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/console/Helper/ProgressBar.php \Symfony\Component\Console\Helper\ProgressBar::__construct()

Constructor.

Parameters

OutputInterface $output An OutputInterface instance:

int $max Maximum steps (0 if unknown):

File

vendor/symfony/console/Helper/ProgressBar.php, line 57

Class

ProgressBar
The ProgressBar provides helpers to display progress output.

Namespace

Symfony\Component\Console\Helper

Code

public function __construct(OutputInterface $output, $max = 0) {
  if ($output instanceof ConsoleOutputInterface) {
    $output = $output
      ->getErrorOutput();
  }
  $this->output = $output;
  $this
    ->setMaxSteps($max);
  if (!$this->output
    ->isDecorated()) {

    // disable overwrite when output does not support ANSI codes.
    $this->overwrite = false;
    if ($this->max > 10) {

      // set a reasonable redraw frequency so output isn't flooded
      $this
        ->setRedrawFrequency($max / 10);
    }
  }
  $this->startTime = time();
}