Documentation

ConsoleSectionOutput extends StreamOutput
in package

StreamOutput writes the output to a given stream.

Tags
author

Pierre du Plessis pdples@gmail.com

author

Gabriel Ostrolucký gabriel.ostrolucky@gmail.com

Table of Contents

$content  : mixed
$formatter  : mixed
$lines  : mixed
$sections  : mixed
$stream  : mixed
$terminal  : mixed
$verbosity  : mixed
__construct()  : mixed
clear()  : mixed
Clears previous output for this section.
getContent()  : string
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.
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).
overwrite()  : mixed
Overwrites the previous output with a new message.
setDecorated()  : mixed
Sets the decorated flag.
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.
doWrite()  : mixed
Writes a message to the output.
hasColorSupport()  : bool
Returns true if the stream supports colorization.
getDisplayLength()  : int
popStreamContentUntilCurrentSection()  : string
At initial stage, cursor is at the end of stream output. This method makes cursor crawl upwards until it hits current section. Then it erases content it crawled through. Optionally, it erases part of current section too.

Properties

$formatter

private mixed $formatter

$verbosity

private mixed $verbosity

Methods

__construct()

public __construct(resource $stream, array<string|int, ConsoleSectionOutput&$sections, int $verbosity, bool $decorated, OutputFormatterInterface $formatter) : mixed
Parameters
$stream : resource
$sections : array<string|int, ConsoleSectionOutput>
$verbosity : int

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

$decorated : bool

Whether to decorate messages (null for auto-guessing)

$formatter : OutputFormatterInterface

Output formatter instance (null to use default OutputFormatter)

Return values
mixed

clear()

Clears previous output for this section.

public clear([int $lines = null ]) : mixed
Parameters
$lines : int = null

Number of lines to clear. If null, then the entire output of this section is cleared

Return values
mixed

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

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

overwrite()

Overwrites the previous output with a new message.

public overwrite(array<string|int, mixed>|string $message) : mixed
Parameters
$message : array<string|int, mixed>|string
Return values
mixed

setDecorated()

Sets the decorated flag.

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

setVerbosity()

Sets the verbosity of the output.

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

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

Return values
mixed

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

Return values
mixed

doWrite()

Writes a message to the output.

protected doWrite(string $message, bool $newline) : mixed
Parameters
$message : string
$newline : bool
Return values
mixed

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

getDisplayLength()

private getDisplayLength(string $text) : int
Parameters
$text : string
Return values
int

popStreamContentUntilCurrentSection()

At initial stage, cursor is at the end of stream output. This method makes cursor crawl upwards until it hits current section. Then it erases content it crawled through. Optionally, it erases part of current section too.

private popStreamContentUntilCurrentSection(int $numberOfLinesToClearFromCurrentSection) : string
Parameters
$numberOfLinesToClearFromCurrentSection : int
Return values
string

Search results