$stream
$stream :
StreamOutput writes the output to a given stream.
Usage:
$output = new StreamOutput(fopen('php://stdout', 'w'));
As StreamOutput
can use any stream, you can also use a file:
$output = new StreamOutput(fopen('/path/to/output.log', 'a', false));
__construct(resource $stream, array<mixed,\app\framework\Component\Console\Output\ConsoleSectionOutput> $sections, \app\framework\Component\Console\Output\int $verbosity, \app\framework\Component\Console\Output\bool $decorated, \app\framework\Component\Console\Output\Formatter\OutputFormatterInterface $formatter)
resource | $stream | A stream resource |
array<mixed,\app\framework\Component\Console\Output\ConsoleSectionOutput> | $sections | |
\app\framework\Component\Console\Output\int | $verbosity | The verbosity level (one of the VERBOSITY constants in OutputInterface) |
\app\framework\Component\Console\Output\bool | $decorated | Whether to decorate messages (null for auto-guessing) |
\app\framework\Component\Console\Output\Formatter\OutputFormatterInterface | $formatter | Output formatter instance (null to use default OutputFormatter) |
write(string|array $messages, boolean $newline = false, integer $options)
Writes a message to the output.
string|array | $messages | The message as an array of lines or a single string |
boolean | $newline | Whether to add a newline |
integer | $options | A bitmask of options (one of the OUTPUT or VERBOSITY constants), 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL |
writeln(string|array $messages, integer $options = self::OUTPUT_NORMAL)
Writes a message to the output and adds a newline at the end.
string|array | $messages | The message as an array of lines of a single string |
integer | $options | A bitmask of options (one of the OUTPUT or VERBOSITY constants), 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL |
setFormatter(\app\framework\Component\Console\Output\Formatter\OutputFormatterInterface $formatter)
{@inheritdoc}
\app\framework\Component\Console\Output\Formatter\OutputFormatterInterface | $formatter |
hasColorSupport() : boolean
Returns true if the stream supports colorization.
Colorization is disabled if not supported by the stream:
true if the stream supports colorization, false otherwise
popStreamContentUntilCurrentSection(\app\framework\Component\Console\Output\int $numberOfLinesToClearFromCurrentSection)
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.
\app\framework\Component\Console\Output\int | $numberOfLinesToClearFromCurrentSection |