class StreamOutput extends Output
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));
Methods
|
__construct(mixed $stream, integer $verbosity = self::VERBOSITY_NORMAL, Boolean|null $decorated = null, OutputFormatterInterface $formatter = null)
Constructor. |
||
|
setFormatter(OutputFormatterInterface $formatter)
Sets output formatter. |
from Output | |
| OutputFormatterInterface |
getFormatter()
Returns current output formatter instance. |
from Output |
|
setDecorated(Boolean $decorated)
Sets the decorated flag. |
from Output | |
| Boolean |
isDecorated()
Gets the decorated flag. |
from Output |
|
setVerbosity(integer $level)
Sets the verbosity of the output. |
from Output | |
| integer |
getVerbosity()
Gets the current verbosity of the output. |
from Output |
|
writeln(string|array $messages, integer $type = self::OUTPUT_NORMAL)
Writes a message to the output and adds a newline at the end. |
from Output | |
|
write(string|array $messages, Boolean $newline = false, integer $type = self::OUTPUT_NORMAL)
Writes a message to the output. |
from Output | |
| resource |
getStream()
Gets the stream attached to this StreamOutput instance. |
Details
at line 47
public
__construct(mixed $stream, integer $verbosity = self::VERBOSITY_NORMAL, Boolean|null $decorated = null, OutputFormatterInterface $formatter = null)
Constructor.
in Output at line 56
public
setFormatter(OutputFormatterInterface $formatter)
Sets output formatter.
in Output at line 64
public OutputFormatterInterface
getFormatter()
Returns current output formatter instance.
in Output at line 72
public
setDecorated(Boolean $decorated)
Sets the decorated flag.
in Output at line 80
public Boolean
isDecorated()
Gets the decorated flag.
in Output at line 88
public
setVerbosity(integer $level)
Sets the verbosity of the output.
in Output at line 96
public integer
getVerbosity()
Gets the current verbosity of the output.
in Output at line 104
public
writeln(string|array $messages, integer $type = self::OUTPUT_NORMAL)
Writes a message to the output and adds a newline at the end.
in Output at line 112
public
write(string|array $messages, Boolean $newline = false, integer $type = self::OUTPUT_NORMAL)
Writes a message to the output.
at line 67
public resource
getStream()
Gets the stream attached to this StreamOutput instance.