Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DebugFormatterHelper.php

function DebugFormatterHelper::progress

Adds progress to a formatting session.

File

vendor/symfony/console/Helper/DebugFormatterHelper.php, line 40

Class

DebugFormatterHelper
Helps outputting debug information when running an external program from a command.

Namespace

Symfony\Component\Console\Helper

Code

public function progress(string $id, string $buffer, bool $error = false, string $prefix = 'OUT', string $errorPrefix = 'ERR') : string {
    $message = '';
    if ($error) {
        if (isset($this->started[$id]['out'])) {
            $message .= "\n";
            unset($this->started[$id]['out']);
        }
        if (!isset($this->started[$id]['err'])) {
            $message .= \sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
            $this->started[$id]['err'] = true;
        }
        $message .= str_replace("\n", \sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
    }
    else {
        if (isset($this->started[$id]['err'])) {
            $message .= "\n";
            unset($this->started[$id]['err']);
        }
        if (!isset($this->started[$id]['out'])) {
            $message .= \sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
            $this->started[$id]['out'] = true;
        }
        $message .= str_replace("\n", \sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
    }
    return $message;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal