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\IOCode
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;
}