ConsoleOutput
class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
ConsoleOutput is the default class for all CLI output. It uses STDOUT and STDERR.
This class is a convenient wrapper around StreamOutput
for both STDOUT and STDERR.
$output = new ConsoleOutput();
This is equivalent to:
$output = new StreamOutput(fopen('php://stdout', 'w'));
$stdErr = new StreamOutput(fopen('php://stderr', 'w'));
Methods
No description
Sets the decorated flag.
Sets the verbosity of the output.
Writes a message to the output and adds a newline at the end.
Writes a message to the output.
Creates a new output section.
Gets the OutputInterface for errors.
Returns true if current environment supports writing console output to STDOUT.
Returns true if current environment supports writing console output to STDERR.
Details
__construct(int|null $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null)
writeln(string|iterable $messages, int $options = self::OUTPUT_NORMAL)
Writes a message to the output and adds a newline at the end.
write(string|iterable $messages, bool $newline = false, int $options = self::OUTPUT_NORMAL)
Writes a message to the output.
protected bool
hasColorSupport()
Returns true if the stream supports colorization.
Colorization is disabled if not supported by the stream:
This is tricky on Windows, because Cygwin, Msys2 etc emulate pseudo terminals via named pipes, so we can only check the environment.
Reference: Composer\XdebugHandler\Process::supportsColor https://github.com/composer/xdebug-handler