You are here

public function ProgressHelper::start in Zircon Profile 8

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

Starts the progress output.

Parameters

OutputInterface $output An Output instance:

int|null $max Maximum steps:

File

vendor/symfony/console/Helper/ProgressHelper.php, line 194

Class

ProgressHelper
The Progress class provides helpers to display progress output.

Namespace

Symfony\Component\Console\Helper

Code

public function start(OutputInterface $output, $max = null) {
  $this->startTime = time();
  $this->current = 0;
  $this->max = (int) $max;

  // Disabling output when it does not support ANSI codes as it would result in a broken display anyway.
  $this->output = $output
    ->isDecorated() ? $output : new NullOutput();
  $this->lastMessagesLength = 0;
  $this->barCharOriginal = '';
  if (null === $this->format) {
    switch ($output
      ->getVerbosity()) {
      case OutputInterface::VERBOSITY_QUIET:
        $this->format = self::FORMAT_QUIET_NOMAX;
        if ($this->max > 0) {
          $this->format = self::FORMAT_QUIET;
        }
        break;
      case OutputInterface::VERBOSITY_VERBOSE:
      case OutputInterface::VERBOSITY_VERY_VERBOSE:
      case OutputInterface::VERBOSITY_DEBUG:
        $this->format = self::FORMAT_VERBOSE_NOMAX;
        if ($this->max > 0) {
          $this->format = self::FORMAT_VERBOSE;
        }
        break;
      default:
        $this->format = self::FORMAT_NORMAL_NOMAX;
        if ($this->max > 0) {
          $this->format = self::FORMAT_NORMAL;
        }
        break;
    }
  }
  $this
    ->initialize();
}