Copied!

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'));
Cloneable Instantiable
Constants
public Symfony\Component\Console\Output\OutputInterface ::OUTPUT_NORMAL = 1
public Symfony\Component\Console\Output\OutputInterface ::OUTPUT_PLAIN = 4
public Symfony\Component\Console\Output\OutputInterface ::OUTPUT_RAW = 2
public Symfony\Component\Console\Output\OutputInterface ::VERBOSITY_DEBUG = 256
public Symfony\Component\Console\Output\OutputInterface ::VERBOSITY_NORMAL = 32
public Symfony\Component\Console\Output\OutputInterface ::VERBOSITY_QUIET = 16
public Symfony\Component\Console\Output\OutputInterface ::VERBOSITY_VERBOSE = 64
public Symfony\Component\Console\Output\OutputInterface ::VERBOSITY_VERY_VERBOSE = 128
Methods
public __construct ( int $verbosity = 32 self::VERBOSITY_NORMAL, ? bool $decorated = NULL , ? Symfony\Component\Console\Formatter\OutputFormatterInterface $formatter = NULL )
 
  • param int | null $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface)
  • param bool $decorated Whether to decorate messages
  • param OutputFormatterInterface | null $formatter Output formatter instance (null to use default OutputFormatter)
  • param int $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface)
  • param bool | null $decorated Whether to decorate messages (null for auto-guessing)
  • param OutputFormatterInterface | null $formatter Output formatter instance (null to use default OutputFormatter)
  • throws InvalidArgumentException When first argument is not a real stream
  • param bool | null $decorated Whether to decorate messages (null for auto-guessing)
  • param OutputFormatterInterface | null $formatter Output formatter instance (null to use default OutputFormatter)
public getErrorOutput () : Symfony\Component\Console\Output\OutputInterface
 
public Symfony\Component\Console\Output\Output :: getFormatter () : Symfony\Component\Console\Formatter\OutputFormatterInterface
 
public Symfony\Component\Console\Output\StreamOutput :: getStream ()
 

Gets the stream attached to this StreamOutput instance.

  • return resource
public Symfony\Component\Console\Output\Output :: getVerbosity () : int
 
public Symfony\Component\Console\Output\Output :: isDebug () : bool
 
public Symfony\Component\Console\Output\Output :: isDecorated () : bool
 
public Symfony\Component\Console\Output\Output :: isQuiet () : bool
 
public Symfony\Component\Console\Output\Output :: isVerbose () : bool
 
public Symfony\Component\Console\Output\Output :: isVeryVerbose () : bool
 
public section () : Symfony\Component\Console\Output\ConsoleSectionOutput
 

Creates a new output section.

public setDecorated ( bool $decorated )
 
public setErrorOutput ( Symfony\Component\Console\Output\OutputInterface $error )
 
public setFormatter ( Symfony\Component\Console\Formatter\OutputFormatterInterface $formatter )
 
public setVerbosity ( int $level )
 
public Symfony\Component\Console\Output\Output :: write ( iterable | string $messages , bool $newline = false , int $options = 1 self::OUTPUT_NORMAL)
 
public Symfony\Component\Console\Output\Output :: writeln ( iterable | string $messages , int $options = 1 self::OUTPUT_NORMAL)
 
Methods
protected Symfony\Component\Console\Output\StreamOutput :: doWrite ( string $message , bool $newline )
 

Writes a message to the output.

protected Symfony\Component\Console\Output\StreamOutput :: hasColorSupport () : bool
 

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

  • return bool true if the stream supports colorization, false otherwise
protected hasStderrSupport () : bool
 

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

protected hasStdoutSupport () : bool
 

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

Properties
private array $consoleSectionOutputs
private Symfony\Component\Console\Output\OutputInterface $stderr
Methods
private isRunningOS400 () : bool
 

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

private openErrorStream ()
 
  • return resource
private openOutputStream ()
 
  • return resource
© 2022 Bruce Wells
Search Namespaces \ Classes
Configuration