\Symfony\Component\Console\OutputConsoleOutput

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'));

Summary

Methods
Properties
Constants
__construct()
getStream()
section()
setDecorated()
setFormatter()
setVerbosity()
getErrorOutput()
setErrorOutput()
No public properties found
No constants found
doWrite()
hasColorSupport()
hasStdoutSupport()
hasStderrSupport()
No protected properties found
N/A
isRunningOS400()
openOutputStream()
openErrorStream()
$stream
$stderr
$consoleSectionOutputs
N/A

Properties

$stream

$stream : 

Type

$stderr

$stderr : 

Type

$consoleSectionOutputs

$consoleSectionOutputs : 

Type

Methods

__construct()

__construct(integer  $verbosity = self::VERBOSITY_NORMAL, boolean|null  $decorated = null, \Symfony\Component\Console\Formatter\OutputFormatterInterface|null  $formatter = null) 

Parameters

integer $verbosity

The verbosity level (one of the VERBOSITY constants in OutputInterface)

boolean|null $decorated

Whether to decorate messages (null for auto-guessing)

\Symfony\Component\Console\Formatter\OutputFormatterInterface|null $formatter

Output formatter instance (null to use default OutputFormatter)

getStream()

getStream() : resource

Gets the stream attached to this StreamOutput instance.

Returns

resource —

A stream resource

section()

section() 

Creates a new output section.

setDecorated()

setDecorated(  $decorated) 

{@inheritdoc}

Parameters

$decorated

setVerbosity()

setVerbosity(  $level) 

{@inheritdoc}

Parameters

$level

doWrite()

doWrite(  $message,   $newline) 

{@inheritdoc}

Parameters

$message
$newline

hasColorSupport()

hasColorSupport() : boolean

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

Returns

boolean —

true if the stream supports colorization, false otherwise

hasStdoutSupport()

hasStdoutSupport() : boolean

Returns true if current environment supports writing console output to STDOUT.

Returns

boolean

hasStderrSupport()

hasStderrSupport() : boolean

Returns true if current environment supports writing console output to STDERR.

Returns

boolean

isRunningOS400()

isRunningOS400() : boolean

Checks if current executing environment is IBM iSeries (OS400), which doesn't properly convert character-encodings between ASCII to EBCDIC.

Returns

boolean

openOutputStream()

openOutputStream() : resource

Returns

resource

openErrorStream()

openErrorStream() : resource

Returns

resource