ConsoleOutput
class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
ConsoleOutput — это по умолчанию класс для всего вывода в консоли. Он использует STDOUT и STDERR.
Этот класс — удобная обёртка вокруг StreamOutput для STDOUT и STDERR.
$output = new ConsoleOutput();
Это эквивалентно:
$output = new StreamOutput(fopen('php://stdout', 'w'));
$stdErr = new StreamOutput(fopen('php://stderr', 'w'));
Методы
| __construct(int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null) | ||
| resource | getStream() Возвращает поток, присоединённый к этому экземпляру StreamOutput. | из StreamOutput |
| setDecorated(bool $decorated) Устанавливает флаг форматирования. | ||
| setFormatter(OutputFormatterInterface $formatter) | ||
| setVerbosity(int $level) Устанавливает подробность вывода. | ||
| OutputInterface | getErrorOutput() Возвращает OutputInterface для ошибок. | |
| setErrorOutput(OutputInterface $error) |
Подробности
__construct(int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null)
Параметры
| int | $verbosity | Уровень подробности (одно из значений констант VERBOSITY в OutputInterface) |
| bool | $decorated | Выводить форматированные сообщения (null для автоматического определения) |
| OutputFormatterInterface | $formatter | Экземпляр форматировщика вывода (null для использования по умолчанию) |
resource getStream()
Возвращает поток, присоединённый к этому экземпляру StreamOutput.
Значение результата
| resource | Ресурс потока |
setDecorated(bool $decorated)
Устанавливает флаг форматирования.
Параметры
| bool | $decorated | Выводить форматированные сообщения |
setFormatter(OutputFormatterInterface $formatter)
Параметры
| OutputFormatterInterface | $formatter |
setVerbosity(int $level)
Устанавливает подробность вывода.
Параметры
| int | $level | Уровень подробности (одно из значений констант VERBOSITY) |
OutputInterface getErrorOutput()
Возвращает OutputInterface для ошибок.
Значение результата
| OutputInterface |
setErrorOutput(OutputInterface $error)
Параметры
| OutputInterface | $error |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/4.0/Symfony/Component/Console/Output/ConsoleOutput.html