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
__construct(int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null) | ||
resource | getStream() Gets the stream attached to this StreamOutput instance. | from StreamOutput |
setDecorated(bool $decorated) Sets the decorated flag. | ||
setFormatter(OutputFormatterInterface $formatter) | ||
setVerbosity(int $level) Sets the verbosity of the output. | ||
OutputInterface | getErrorOutput() Gets the OutputInterface for errors. | |
setErrorOutput(OutputInterface $error) |
Details
__construct(int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null)
Parameters
int | $verbosity | The verbosity level (one of the VERBOSITY constants in OutputInterface) |
bool | $decorated | Whether to decorate messages (null for auto-guessing) |
OutputFormatterInterface | $formatter | Output formatter instance (null to use default OutputFormatter) |
resource getStream()
Gets the stream attached to this StreamOutput instance.
Return Value
resource | A stream resource |
setDecorated(bool $decorated)
Sets the decorated flag.
Parameters
bool | $decorated | Whether to decorate the messages |
setFormatter(OutputFormatterInterface $formatter)
Parameters
OutputFormatterInterface | $formatter |
setVerbosity(int $level)
Sets the verbosity of the output.
Parameters
int | $level | The level of verbosity (one of the VERBOSITY constants) |
OutputInterface getErrorOutput()
Gets the OutputInterface for errors.
Return Value
OutputInterface |
setErrorOutput(OutputInterface $error)
Parameters
OutputInterface | $error |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/4.0/Symfony/Component/Console/Output/ConsoleOutput.html