You are here

public function ProgressBar::display 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::display()

Outputs the current progress string.

2 calls to ProgressBar::display()
ProgressBar::setProgress in vendor/symfony/console/Helper/ProgressBar.php
Sets the current progress.
ProgressBar::start in vendor/symfony/console/Helper/ProgressBar.php
Starts the progress output.

File

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

Class

ProgressBar
The ProgressBar provides helpers to display progress output.

Namespace

Symfony\Component\Console\Helper

Code

public function display() {
  if (OutputInterface::VERBOSITY_QUIET === $this->output
    ->getVerbosity()) {
    return;
  }
  if (null === $this->format) {
    $this
      ->setRealFormat($this->internalFormat ?: $this
      ->determineBestFormat());
  }

  // these 3 variables can be removed in favor of using $this in the closure when support for PHP 5.3 will be dropped.
  $self = $this;
  $output = $this->output;
  $messages = $this->messages;
  $this
    ->overwrite(preg_replace_callback("{%([a-z\\-_]+)(?:\\:([^%]+))?%}i", function ($matches) use ($self, $output, $messages) {
    if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
      $text = call_user_func($formatter, $self, $output);
    }
    elseif (isset($messages[$matches[1]])) {
      $text = $messages[$matches[1]];
    }
    else {
      return $matches[0];
    }
    if (isset($matches[2])) {
      $text = sprintf('%' . $matches[2], $text);
    }
    return $text;
  }, $this->format));
}