ConsoleOutput
        
        extends StreamOutput
    
    
            
            in package
            
        
    
            
            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'));
Tags
Table of Contents
Interfaces
- ConsoleOutputInterface
 - ConsoleOutputInterface is the interface implemented by ConsoleOutput class.
 
Methods
- __construct() : mixed
 - getErrorOutput() : OutputInterface
 - Gets the OutputInterface for errors.
 - getFormatter() : OutputFormatterInterface
 - Returns current output formatter instance.
 - getStream() : resource
 - Gets the stream attached to this StreamOutput instance.
 - getVerbosity() : self::VERBOSITY_*
 - Gets the current verbosity of the output.
 - isDebug() : bool
 - Returns whether verbosity is debug (-vvv).
 - isDecorated() : bool
 - Gets the decorated flag.
 - isQuiet() : bool
 - Returns whether verbosity is quiet (-q).
 - isSilent() : bool
 - isVerbose() : bool
 - Returns whether verbosity is verbose (-v).
 - isVeryVerbose() : bool
 - Returns whether verbosity is very verbose (-vv).
 - section() : ConsoleSectionOutput
 - Creates a new output section.
 - setDecorated() : void
 - Sets the decorated flag.
 - setErrorOutput() : void
 - setFormatter() : void
 - setVerbosity() : void
 - Sets the verbosity of the output.
 - write() : void
 - Writes a message to the output.
 - writeln() : void
 - Writes a message to the output and adds a newline at the end.
 - doWrite() : void
 - Writes a message to the output.
 - hasColorSupport() : bool
 - Returns true if the stream supports colorization.
 - hasStderrSupport() : bool
 - Returns true if current environment supports writing console output to STDERR.
 - hasStdoutSupport() : bool
 - Returns true if current environment supports writing console output to STDOUT.
 
Methods
__construct()
    public
                    __construct([int $verbosity = self::VERBOSITY_NORMAL ][, bool|null $decorated = null ][, OutputFormatterInterface|null $formatter = null ]) : mixed
    Parameters
- $verbosity : int = self::VERBOSITY_NORMAL
 - 
                    
The verbosity level (one of the VERBOSITY constants in OutputInterface)
 - $decorated : bool|null = null
 - 
                    
Whether to decorate messages (null for auto-guessing)
 - $formatter : OutputFormatterInterface|null = null
 - 
                    
Output formatter instance (null to use default OutputFormatter)
 
getErrorOutput()
Gets the OutputInterface for errors.
    public
                    getErrorOutput() : OutputInterface
    Return values
OutputInterfacegetFormatter()
Returns current output formatter instance.
    public
                    getFormatter() : OutputFormatterInterface
    Return values
OutputFormatterInterfacegetStream()
Gets the stream attached to this StreamOutput instance.
    public
                    getStream() : resource
    Return values
resourcegetVerbosity()
Gets the current verbosity of the output.
    public
                    getVerbosity() : self::VERBOSITY_*
    Return values
self::VERBOSITY_*isDebug()
Returns whether verbosity is debug (-vvv).
    public
                    isDebug() : bool
    Return values
boolisDecorated()
Gets the decorated flag.
    public
                    isDecorated() : bool
    Return values
boolisQuiet()
Returns whether verbosity is quiet (-q).
    public
                    isQuiet() : bool
    Return values
boolisSilent()
    public
                    isSilent() : bool
    Return values
boolisVerbose()
Returns whether verbosity is verbose (-v).
    public
                    isVerbose() : bool
    Return values
boolisVeryVerbose()
Returns whether verbosity is very verbose (-vv).
    public
                    isVeryVerbose() : bool
    Return values
boolsection()
Creates a new output section.
    public
                    section() : ConsoleSectionOutput
    Return values
ConsoleSectionOutputsetDecorated()
Sets the decorated flag.
    public
                    setDecorated(bool $decorated) : void
    Parameters
- $decorated : bool
 
setErrorOutput()
    public
                    setErrorOutput(OutputInterface $error) : void
    Parameters
- $error : OutputInterface
 
setFormatter()
    public
                    setFormatter(OutputFormatterInterface $formatter) : void
    Parameters
- $formatter : OutputFormatterInterface
 
setVerbosity()
Sets the verbosity of the output.
    public
                    setVerbosity(int $level) : void
    Parameters
- $level : int
 
write()
Writes a message to the output.
    public
                    write(string|iterable<string|int, mixed> $messages[, bool $newline = false ][, int $options = self::OUTPUT_NORMAL ]) : void
    Parameters
- $messages : string|iterable<string|int, mixed>
 - $newline : bool = false
 - 
                    
Whether to add a newline
 - $options : int = self::OUTPUT_NORMAL
 - 
                    
A bitmask of options (one of the OUTPUT or VERBOSITY constants), 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL
 
writeln()
Writes a message to the output and adds a newline at the end.
    public
                    writeln(string|iterable<string|int, mixed> $messages[, int $options = self::OUTPUT_NORMAL ]) : void
    Parameters
- $messages : string|iterable<string|int, mixed>
 - $options : int = self::OUTPUT_NORMAL
 - 
                    
A bitmask of options (one of the OUTPUT or VERBOSITY constants), 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL
 
doWrite()
Writes a message to the output.
    protected
                    doWrite(string $message, bool $newline) : void
    Parameters
- $message : string
 - $newline : bool
 
hasColorSupport()
Returns true if the stream supports colorization.
    protected
                    hasColorSupport() : bool
    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
Return values
bool —true if the stream supports colorization, false otherwise
hasStderrSupport()
Returns true if current environment supports writing console output to STDERR.
    protected
                    hasStderrSupport() : bool
    Return values
boolhasStdoutSupport()
Returns true if current environment supports writing console output to STDOUT.
    protected
                    hasStdoutSupport() : bool