ProcOutputPager
extends StreamOutput
in package
implements
OutputPager
ProcOutputPager class.
A ProcOutputPager instance wraps a regular StreamOutput's stream. Rather
than writing directly to the stream, it shells out to a pager process and
gives that process the stream as stdout. This means regular *nix commands
like less and more can be used to page large amounts of output.
Interfaces, Classes and Traits
- OutputPager
- An output pager is much the same as a regular OutputInterface, but allows the stream to be flushed to a pager periodically.
Table of Contents
- $cmd : mixed
- $formatter : mixed
- $pipe : mixed
- $proc : mixed
- $stream : mixed
- $verbosity : mixed
- __construct() : mixed
- Constructor.
- close() : mixed
- Close the current pager process.
- doWrite() : mixed
- Writes a message to the output.
- 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).
- 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.
- hasColorSupport() : bool
- Returns true if the stream supports colorization.
- getPipe() : mixed
- Get a pipe for paging output.
Properties
$cmd
private
mixed
$cmd
$formatter
private
mixed
$formatter
$pipe
private
mixed
$pipe
$proc
private
mixed
$proc
$stream
private
mixed
$stream
$verbosity
private
mixed
$verbosity
Methods
__construct()
Constructor.
public
__construct(StreamOutput $output[, string $cmd = 'less -R -S -F -X' ]) : mixed
Parameters
- $output : StreamOutput
- $cmd : string = 'less -R -S -F -X'
-
Pager process command (default: 'less -R -S -F -X')
Return values
mixed —close()
Close the current pager process.
public
close() : mixed
Return values
mixed —doWrite()
Writes a message to the output.
public
doWrite(string $message, bool $newline) : mixed
Parameters
- $message : string
-
A message to write to the output
- $newline : bool
-
Whether to add a newline or not
Tags
Return values
mixed —getFormatter()
Returns current output formatter instance.
public
getFormatter() : OutputFormatterInterface
Return values
OutputFormatterInterface —getStream()
Gets the stream attached to this StreamOutput instance.
public
getStream() : resource
Return values
resource —A stream resource
getVerbosity()
Gets the current verbosity of the output.
public
getVerbosity() : int
Return values
int —The current level of verbosity (one of the VERBOSITY constants)
isDebug()
Returns whether verbosity is debug (-vvv).
public
isDebug() : bool
Return values
bool —true if verbosity is set to VERBOSITY_DEBUG, false otherwise
isDecorated()
Gets the decorated flag.
public
isDecorated() : bool
Return values
bool —true if the output will decorate messages, false otherwise
isQuiet()
Returns whether verbosity is quiet (-q).
public
isQuiet() : bool
Return values
bool —true if verbosity is set to VERBOSITY_QUIET, false otherwise
isVerbose()
Returns whether verbosity is verbose (-v).
public
isVerbose() : bool
Return values
bool —true if verbosity is set to VERBOSITY_VERBOSE, false otherwise
isVeryVerbose()
Returns whether verbosity is very verbose (-vv).
public
isVeryVerbose() : bool
Return values
bool —true if verbosity is set to VERBOSITY_VERY_VERBOSE, false otherwise
setDecorated()
Sets the decorated flag.
public
setDecorated(mixed $decorated) : mixed
Parameters
- $decorated : mixed
-
Whether to decorate the messages
Return values
mixed —setFormatter()
public
setFormatter(OutputFormatterInterface $formatter) : mixed
Parameters
- $formatter : OutputFormatterInterface
Return values
mixed —setVerbosity()
Sets the verbosity of the output.
public
setVerbosity(mixed $level) : mixed
Parameters
- $level : mixed
-
The level of verbosity (one of the VERBOSITY constants)
Return values
mixed —write()
Writes a message to the output.
public
write(mixed $messages[, mixed $newline = false ][, mixed $options = self::OUTPUT_NORMAL ]) : mixed
Parameters
- $messages : mixed
-
The message as an array of strings or a single string
- $newline : mixed = false
-
Whether to add a newline
- $options : mixed = 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[, mixed $options = self::OUTPUT_NORMAL ]) : mixed
Parameters
- $messages : mixed
-
The message as an array of strings or a single string
- $options : mixed = 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 —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
getPipe()
Get a pipe for paging output.
private
getPipe() : mixed
If no active pager process exists, fork one and return its input pipe.