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

Breadcrumb

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

function BufferIO::getOutput

Return value

string output

File

vendor/composer/composer/src/Composer/IO/BufferIO.php, line 49

Class

BufferIO
@author Jordi Boggiano <j.boggiano@seld.be>

Namespace

Composer\IO

Code

public function getOutput() : string {
    assert($this->output instanceof StreamOutput);
    fseek($this->output
        ->getStream(), 0);
    $output = (string) stream_get_contents($this->output
        ->getStream());
    $output = Preg::replaceCallback("{(?<=^|\n|\x08)(.+?)(\x08+)}", static function ($matches) : string {
        $pre = strip_tags($matches[1]);
        if (strlen($pre) === strlen($matches[2])) {
            return '';
        }
        // TODO reverse parse the string, skipping span tags and \033\[([0-9;]+)m(.*?)\033\[0m style blobs
        return rtrim($matches[1]) . "\n";
    }, $output);
    return $output;
}

API Navigation

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