PHP Class Webmozart\Console\Api\IO\Output

This class wraps an output stream and adds convenience functionality for writing that stream.
Since: 1.0
Author: Bernhard Schussek ([email protected])
Inheritance: implements Webmozart\Console\Api\Formatter\Formatter
Afficher le fichier Open project: webmozart/console Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( Webmozart\Console\Api\IO\OutputStream $stream, Webmozart\Console\Api\Formatter\Formatter $formatter = null ) Creates an output for the given output stream.
close ( ) Closes the output.
flush ( ) Forces all pending text to be written out.
format ( $string, Style $style = null )
getFormatter ( ) : Webmozart\Console\Api\Formatter\Formatter Returns the output formatter.
getStream ( ) : Webmozart\Console\Api\IO\OutputStream Returns the underlying stream.
getVerbosity ( ) : integer Returns the current verbosity level.
isClosed ( ) : boolean Returns whether the output is closed.
isDebug ( ) : boolean Returns whether the verbosity level is {@link IO::DEBUG}.
isQuiet ( ) : boolean Returns whether output is suppressed completely.
isVerbose ( ) : boolean Returns whether the verbosity level is {@link IO::VERBOSE} or greater.
isVeryVerbose ( ) : boolean Returns whether the verbosity level is {@link IO::VERY_VERBOSE} or greater.
removeFormat ( $string )
setFormatter ( Webmozart\Console\Api\Formatter\Formatter $formatter ) Sets the output formatter.
setQuiet ( boolean $quiet ) Sets whether output should be suppressed completely.
setStream ( Webmozart\Console\Api\IO\OutputStream $stream ) Sets the underlying stream.
setVerbosity ( integer $verbosity ) Sets the verbosity level of the output.
write ( string $string, integer $flags = null ) Writes a string to the output stream.
writeLine ( string $string, integer $flags = null ) Writes a line of text to the output stream.
writeLineRaw ( string $string, integer $flags = null ) Writes a line of text to the output stream without formatting.
writeRaw ( string $string, integer $flags = null ) Writes a string to the output stream without formatting.

Méthodes protégées

Méthode Description
mayWrite ( integer $flags ) : boolean Returns whether an output may be written for the given flags.

Method Details

__construct() public méthode

Creates an output for the given output stream.
public __construct ( Webmozart\Console\Api\IO\OutputStream $stream, Webmozart\Console\Api\Formatter\Formatter $formatter = null )
$stream Webmozart\Console\Api\IO\OutputStream The output stream.
$formatter Webmozart\Console\Api\Formatter\Formatter The formatter for formatting text written to the output stream.

close() public méthode

Closes the output.
public close ( )

flush() public méthode

Forces all pending text to be written out.
public flush ( )

format() public méthode

public format ( $string, Style $style = null )
$style Webmozart\Console\Api\Formatter\Style

getFormatter() public méthode

Returns the output formatter.
public getFormatter ( ) : Webmozart\Console\Api\Formatter\Formatter
Résultat Webmozart\Console\Api\Formatter\Formatter The output formatter.

getStream() public méthode

Returns the underlying stream.
public getStream ( ) : Webmozart\Console\Api\IO\OutputStream
Résultat Webmozart\Console\Api\IO\OutputStream The output stream.

getVerbosity() public méthode

Returns the current verbosity level.
public getVerbosity ( ) : integer
Résultat integer One of the verbosity constants.

isClosed() public méthode

Returns whether the output is closed.
public isClosed ( ) : boolean
Résultat boolean Returns `true` if the output is closed and `false` otherwise.

isDebug() public méthode

Returns whether the verbosity level is {@link IO::DEBUG}.
public isDebug ( ) : boolean
Résultat boolean Returns `true` if the verbosity level is {@link IO::DEBUG} and `false` otherwise.

isQuiet() public méthode

Returns whether output is suppressed completely.
public isQuiet ( ) : boolean
Résultat boolean Returns `true` if all output is suppressed and `false` otherwise.

isVerbose() public méthode

Returns whether the verbosity level is {@link IO::VERBOSE} or greater.
public isVerbose ( ) : boolean
Résultat boolean Returns `true` if the verbosity level is {@link IO::VERBOSE} or greater and `false` otherwise.

isVeryVerbose() public méthode

Returns whether the verbosity level is {@link IO::VERY_VERBOSE} or greater.
public isVeryVerbose ( ) : boolean
Résultat boolean Returns `true` if the verbosity level is {@link IO::VERY_VERBOSE} or greater and `false` otherwise.

mayWrite() protected méthode

Returns whether an output may be written for the given flags.
protected mayWrite ( integer $flags ) : boolean
$flags integer The flags.
Résultat boolean Returns `true` if the output may be written and `false` otherwise.

removeFormat() public méthode

public removeFormat ( $string )

setFormatter() public méthode

Sets the output formatter.
public setFormatter ( Webmozart\Console\Api\Formatter\Formatter $formatter )
$formatter Webmozart\Console\Api\Formatter\Formatter The output formatter.

setQuiet() public méthode

Sets whether output should be suppressed completely.
public setQuiet ( boolean $quiet )
$quiet boolean Pass `true` to suppress all output and `false` otherwise.

setStream() public méthode

Sets the underlying stream.
public setStream ( Webmozart\Console\Api\IO\OutputStream $stream )
$stream Webmozart\Console\Api\IO\OutputStream The output stream.

setVerbosity() public méthode

Sets the verbosity level of the output.
public setVerbosity ( integer $verbosity )
$verbosity integer One of the constants {@link NORMAL}, {@link VERBOSE}, {@link VERY_VERBOSE} or {@link DEBUG}. Only output with the given verbosity level or smaller will be written out.

write() public méthode

The string is formatted before it is written to the output stream.
public write ( string $string, integer $flags = null )
$string string The string to write.
$flags integer The flags. If one of of {@link IO::VERBOSE}, {@link IO::VERY_VERBOSE} and {@link IO::DEBUG} is passed, the output is only written if the verbosity level is the given level or higher.

writeLine() public méthode

The string is formatted before it is written to the output stream.
public writeLine ( string $string, integer $flags = null )
$string string The string to write. A newline is appended.
$flags integer The flags. If one of of {@link IO::VERBOSE}, {@link IO::VERY_VERBOSE} and {@link IO::DEBUG} is passed, the output is only written if the verbosity level is the given level or higher.

writeLineRaw() public méthode

Writes a line of text to the output stream without formatting.
public writeLineRaw ( string $string, integer $flags = null )
$string string The string to write. A newline is appended.
$flags integer The flags. If one of of {@link IO::VERBOSE}, {@link IO::VERY_VERBOSE} and {@link IO::DEBUG} is passed, the output is only written if the verbosity level is the given level or higher.

writeRaw() public méthode

Writes a string to the output stream without formatting.
public writeRaw ( string $string, integer $flags = null )
$string string The string to write.
$flags integer The flags. If one of of {@link IO::VERBOSE}, {@link IO::VERY_VERBOSE} and {@link IO::DEBUG} is passed, the output is only written if the verbosity level is the given level or higher.