SymfonyComponentConsoleOutputConsoleOutput

ConsoleOutput is the default class for all CLI output. It uses STDOUT.

This class is a convenient wrapper around StreamOutput.

$output = new ConsoleOutput();

This is equivalent to:

$output = new StreamOutput(fopen('php://stdout', 'w'));

Properties

$stream

$stream : 

Type

Inherited from
SymfonyComponentConsoleOutputStreamOutput

Tags

None found

$verbosity

$verbosity : 

Type

Inherited from
SymfonyComponentConsoleOutputOutput

Tags

None found

$formatter

$formatter : 

Type

Inherited from
SymfonyComponentConsoleOutputOutput

Tags

None found

$stderr

$stderr : 

Type

Tags

None found

Methods

__construct()

__construct(integer  $verbosity = self::VERBOSITY_NORMAL, Boolean  $decorated = null, \Symfony\Component\Console\Formatter\OutputFormatter  $formatter = null) 

Constructor.

Parameters

integer $verbosity

The verbosity level (self::VERBOSITY_QUIET, self::VERBOSITY_NORMAL, self::VERBOSITY_VERBOSE)

Boolean $decorated

Whether to decorate messages or not (null for auto-guessing)

SymfonyComponentConsoleFormatterOutputFormatter $formatter

Output formatter instance

Tags

api

getStream()

getStream() : resource

Gets the stream attached to this StreamOutput instance.

Returns

resource —

A stream resource

Inherited from
SymfonyComponentConsoleOutputStreamOutput

Tags

None found

doWrite()

doWrite(string  $message, Boolean  $newline) 

Writes a message to the output.

Parameters

string $message

A message to write to the output

Boolean $newline

Whether to add a newline or not

abstract
Inherited from
SymfonyComponentConsoleOutputOutput

Tags

None found

setFormatter()

setFormatter(\Symfony\Component\Console\Formatter\OutputFormatterInterface  $formatter) 

Parameters

SymfonyComponentConsoleFormatterOutputFormatterInterface $formatter

Tags

None found

getFormatter()

getFormatter() : \Symfony\Component\Console\Formatter\OutputFormatterInterface

Returns current output formatter instance.

Returns

SymfonyComponentConsoleFormatterOutputFormatterInterface

setDecorated()

setDecorated(  $decorated) 

Parameters

$decorated

Tags

None found

isDecorated()

isDecorated() : Boolean

Gets the decorated flag.

Returns

Boolean —

true if the output will decorate messages, false otherwise

setVerbosity()

setVerbosity(  $level) 

Parameters

$level

Tags

None found

getVerbosity()

getVerbosity() : integer

Gets the current verbosity of the output.

Returns

integer —

The current level of verbosity

writeln()

writeln(string|array  $messages, integer  $type) 

Writes a message to the output and adds a newline at the end.

Parameters

string|array $messages

The message as an array of lines of a single string

integer $type

The type of output

write()

write(string|array  $messages, Boolean  $newline = false, integer  $type) 

Writes a message to the output.

Parameters

string|array $messages

The message as an array of lines of a single string

Boolean $newline

Whether to add a newline or not

integer $type

The type of output

Throws

InvalidArgumentException

When unknown output type is given

getErrorOutput()

getErrorOutput() : \Symfony\Component\Console\Output\OutputInterface

Returns

SymfonyComponentConsoleOutputOutputInterface

Tags

None found

setErrorOutput()

setErrorOutput(\Symfony\Component\Console\Output\OutputInterface  $error) 

Parameters

SymfonyComponentConsoleOutputOutputInterface $error

Tags

None found

hasColorSupport()

hasColorSupport() : Boolean

Returns true if the stream supports colorization.

Colorization is disabled if not supported by the stream:

  • windows without ansicon
  • non tty consoles

Returns

Boolean —

true if the stream supports colorization, false otherwise

Inherited from
SymfonyComponentConsoleOutputStreamOutput

Tags

None found