HumHub Documentation (unofficial)

Output extends ConsoleOutput
in package

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

Table of Contents

Properties

$formatHelper  : FormatterHelper
$waitForDebugOutput  : mixed
$config  : mixed
$isInteractive  : mixed
$consoleSectionOutputs  : mixed
$formatter  : mixed
$stderr  : mixed
$stream  : mixed
$verbosity  : mixed

Methods

__construct()  : mixed
debug()  : mixed
exception()  : 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()  : int
Gets the current verbosity of the output.
isDebug()  : bool
Returns whether verbosity is debug (-vvv).
isDecorated()  : bool
Gets the decorated flag.
isInteractive()  : mixed
isQuiet()  : bool
Returns whether verbosity is quiet (-q).
isVerbose()  : bool
Returns whether verbosity is verbose (-v).
isVeryVerbose()  : bool
Returns whether verbosity is very verbose (-vv).
message()  : mixed
notification()  : mixed
section()  : ConsoleSectionOutput
Creates a new output section.
setDecorated()  : mixed
Sets the decorated flag.
setErrorOutput()  : mixed
setFormatter()  : mixed
setVerbosity()  : mixed
Sets the verbosity of the output.
write()  : mixed
Writes a message to the output.
writeln()  : mixed
Writes a message to the output and adds a newline at the end.
clean()  : mixed
doWrite()  : mixed
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.
isRunningOS400()  : bool
Checks if current executing environment is IBM iSeries (OS400), which doesn't properly convert character-encodings between ASCII to EBCDIC.
openErrorStream()  : resource
openOutputStream()  : resource

Properties

$waitForDebugOutput

public mixed $waitForDebugOutput = true

$config

protected mixed $config = ['colors' => true, 'verbosity' => self::VERBOSITY_NORMAL, 'interactive' => true]

$isInteractive

protected mixed $isInteractive = false

$consoleSectionOutputs

private mixed $consoleSectionOutputs = []

$formatter

private mixed $formatter

$verbosity

private mixed $verbosity

Methods

__construct()

public __construct(mixed $config) : mixed
Parameters
$config : mixed

debug()

public debug(mixed $message) : mixed
Parameters
$message : mixed

exception()

public exception(Exception $e) : mixed
Parameters
$e : Exception

getStream()

Gets the stream attached to this StreamOutput instance.

public getStream() : resource
Return values
resource

getVerbosity()

Gets the current verbosity of the output.

public getVerbosity() : int
Return values
int

isDebug()

Returns whether verbosity is debug (-vvv).

public isDebug() : bool
Return values
bool

isDecorated()

Gets the decorated flag.

public isDecorated() : bool
Return values
bool

isInteractive()

public isInteractive() : mixed

isQuiet()

Returns whether verbosity is quiet (-q).

public isQuiet() : bool
Return values
bool

isVerbose()

Returns whether verbosity is verbose (-v).

public isVerbose() : bool
Return values
bool

isVeryVerbose()

Returns whether verbosity is very verbose (-vv).

public isVeryVerbose() : bool
Return values
bool

message()

public message(mixed $message) : mixed
Parameters
$message : mixed

notification()

public notification(mixed $message) : mixed
Parameters
$message : mixed

setDecorated()

Sets the decorated flag.

public setDecorated(bool $decorated) : mixed
Parameters
$decorated : bool

setVerbosity()

Sets the verbosity of the output.

public setVerbosity(int $level) : mixed
Parameters
$level : int

write()

Writes a message to the output.

public write(mixed $messages[, bool $newline = false ][, int $options = self::OUTPUT_NORMAL ]) : mixed
Parameters
$messages : mixed

The message as an iterable of strings or a single string

$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(mixed $messages[, int $options = self::OUTPUT_NORMAL ]) : mixed
Parameters
$messages : mixed

The message as an iterable of strings or a single string

$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

clean()

protected clean(mixed $message) : mixed
Parameters
$message : mixed

doWrite()

Writes a message to the output.

protected doWrite(string $message, bool $newline) : mixed
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
bool

hasStdoutSupport()

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

protected hasStdoutSupport() : bool
Return values
bool

isRunningOS400()

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

private isRunningOS400() : bool
Return values
bool

openErrorStream()

private openErrorStream() : resource
Return values
resource

openOutputStream()

private openOutputStream() : resource
Return values
resource

        
On this page

Search results