You are here

private function ProgressHelper::overwrite 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::overwrite()

Overwrites a previous message to the output.

Parameters

OutputInterface $output An Output instance:

string $message The message:

2 calls to ProgressHelper::overwrite()
ProgressHelper::clear in vendor/symfony/console/Helper/ProgressHelper.php
Removes the progress bar from the current line.
ProgressHelper::display in vendor/symfony/console/Helper/ProgressHelper.php
Outputs the current progress string.

File

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

Class

ProgressHelper
The Progress class provides helpers to display progress output.

Namespace

Symfony\Component\Console\Helper

Code

private function overwrite(OutputInterface $output, $message) {
  $length = $this
    ->strlen($message);

  // append whitespace to match the last line's length
  if (null !== $this->lastMessagesLength && $this->lastMessagesLength > $length) {
    $message = str_pad($message, $this->lastMessagesLength, " ", STR_PAD_RIGHT);
  }

  // carriage return
  $output
    ->write("\r");
  $output
    ->write($message);
  $this->lastMessagesLength = $this
    ->strlen($message);
}