-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
BufferedConsoleOutput.php
51 lines (43 loc) · 1.59 KB
/
BufferedConsoleOutput.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
namespace Drush\Symfony;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\Console\Output\BufferedOutput;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Output\ConsoleSectionOutput;
use Symfony\Component\Console\Output\OutputInterface;
/**
* BufferedConsoleOutput supports separation of the stdout and stderr streams.
*/
class BufferedConsoleOutput extends BufferedOutput implements ConsoleOutputInterface
{
protected $stderr;
private array $consoleSectionOutputs = [];
/**
* @param int $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface)
* @param bool|null $decorated Whether to decorate messages (null for auto-guessing)
* @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter)
*/
public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = false, OutputFormatterInterface $formatter = null)
{
parent::__construct($verbosity, $decorated, $formatter);
$this->stderr = new BufferedOutput($this->getVerbosity(), $this->isDecorated(), $this->getFormatter());
}
/**
* {@inheritdoc}
*/
public function getErrorOutput(): BufferedOutput
{
return $this->stderr;
}
/**
* {@inheritdoc}
*/
public function setErrorOutput(OutputInterface $error): void
{
$this->stderr = $error;
}
public function section(): ConsoleSectionOutput
{
// @todo
}
}