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

Breadcrumb

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

function TesterTrait::getDisplay

Gets the display returned by the last execution of the command or application.

Throws

\RuntimeException If it's called before the execute method

File

vendor/symfony/console/Tester/TesterTrait.php, line 37

Class

TesterTrait
@author Amrouche Hamza <hamza.simperfit@gmail.com>

Namespace

Symfony\Component\Console\Tester

Code

public function getDisplay(bool $normalize = false) : string {
    if (!isset($this->output)) {
        throw new \RuntimeException('Output not initialized, did you execute the command before requesting the display?');
    }
    rewind($this->output
        ->getStream());
    $display = stream_get_contents($this->output
        ->getStream());
    if ($normalize) {
        $display = str_replace(\PHP_EOL, "\n", $display);
    }
    return $display;
}

API Navigation

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