StreamOutput writes the output to a given stream.
- Full name:
\Symfony\Component\Console\Output\ConsoleSectionOutput
- Parent class:
\Symfony\Component\Console\Output\StreamOutput
private $content
private $lines
private $sections
private $terminal
public __construct(resource $stream, \Symfony\Component\Console\Output\ConsoleSectionOutput[]& $sections, int $verbosity, bool $decorated, \Symfony\Component\Console\Formatter\OutputFormatterInterface $formatter): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$stream |
resource | |
$sections |
\Symfony\Component\Console\Output\ConsoleSectionOutput[] | |
$verbosity |
int | The verbosity level (one of the VERBOSITY constants in OutputInterface) |
$decorated |
bool | Whether to decorate messages (null for auto-guessing) |
$formatter |
\Symfony\Component\Console\Formatter\OutputFormatterInterface | Output formatter instance (null to use default OutputFormatter) |
Clears previous output for this section.
public clear(int $lines = null): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$lines |
int | Number of lines to clear. If null, then the entire output of this section is cleared |
Overwrites the previous output with a new message.
public overwrite(array|string $message): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$message |
array|string |
public getContent(): string
Writes a message to the output.
protected doWrite(string $message, bool $newline): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$message |
string | |
$newline |
bool |
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:
Parameter | Type | Description |
---|---|---|
$numberOfLinesToClearFromCurrentSection |
int |
private getDisplayLength(string $text): int
Parameters:
Parameter | Type | Description |
---|---|---|
$text |
string |
public __construct(int|null $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, \Symfony\Component\Console\Formatter\OutputFormatterInterface|null $formatter = null): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$verbosity |
int|null | The verbosity level (one of the VERBOSITY constants in OutputInterface) |
$decorated |
bool | Whether to decorate messages |
$formatter |
\Symfony\Component\Console\Formatter\OutputFormatterInterface|null | Output formatter instance (null to use default OutputFormatter) |
Gets the stream attached to this StreamOutput instance.
public getStream(): resource
Writes a message to the output.
protected doWrite(string $message, bool $newline): mixed
- This method is abstract.
Parameters:
Parameter | Type | Description |
---|---|---|
$message |
string | |
$newline |
bool |
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 Value:
true if the stream supports colorization, false otherwise
public setFormatter(\Symfony\Component\Console\Formatter\OutputFormatterInterface $formatter): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$formatter |
\Symfony\Component\Console\Formatter\OutputFormatterInterface |
Returns current output formatter instance.
public getFormatter(): \Symfony\Component\Console\Formatter\OutputFormatterInterface
Sets the decorated flag.
public setDecorated(bool $decorated): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$decorated |
bool |
Gets the decorated flag.
public isDecorated(): bool
Sets the verbosity of the output.
public setVerbosity(int $level): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$level |
int |
Gets the current verbosity of the output.
public getVerbosity(): int
Returns whether verbosity is quiet (-q).
public isQuiet(): bool
Returns whether verbosity is verbose (-v).
public isVerbose(): bool
Returns whether verbosity is very verbose (-vv).
public isVeryVerbose(): bool
Returns whether verbosity is debug (-vvv).
public isDebug(): bool
Writes a message to the output and adds a newline at the end.
public writeln(mixed $messages, int $options = self::OUTPUT_NORMAL): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$messages |
mixed | The message as an iterable of strings or a single string |
$options |
int | A bitmask of options (one of the OUTPUT or VERBOSITY constants), 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL |
Writes a message to the output.
public write(mixed $messages, bool $newline = false, int $options = self::OUTPUT_NORMAL): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$messages |
mixed | The message as an iterable of strings or a single string |
$newline |
bool | Whether to add a newline |
$options |
int | A bitmask of options (one of the OUTPUT or VERBOSITY constants), 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL |