PHP Class Webmozart\Console\Api\IO\IO

Since: 1.0
Author: Bernhard Schussek ([email protected])
Inheritance: implements Webmozart\Console\Api\Formatter\Formatter
Mostra file Open project: webmozart/console Class Usage Examples

Public Methods

Method Description
__construct ( Input $input, Output $output, Output $errorOutput ) Creates an I/O based on the given input and outputs.
close ( ) Closes the input and the outputs.
error ( string $string, integer $flags = null ) Writes a string to the error output.
errorLine ( string $string, integer $flags = null ) Writes a line of text to the error output.
errorLineRaw ( string $string, integer $flags = null ) Writes a line of text to the error output without formatting.
errorRaw ( string $string, integer $flags = null ) Writes a string to the error output without formatting.
flush ( ) Flushes the outputs and forces all pending text to be written out.
format ( $string, Style $style = null )
getErrorOutput ( ) : Output Returns the error output.
getFormatter ( ) : Webmozart\Console\Api\Formatter\Formatter Returns the output formatter.
getInput ( ) : Input Returns the standard input.
getOutput ( ) : Output Returns the standard output.
getTerminalDimensions ( ) : Rectangle Returns the dimensions of the terminal.
getVerbosity ( ) : integer Returns the current verbosity level.
isDebug ( ) : boolean Returns whether the verbosity is {@link DEBUG}.
isInteractive ( ) : boolean Returns whether the user may be asked for input.
isQuiet ( ) : boolean Returns whether all output is suppressed.
isVerbose ( ) : boolean Returns whether the verbosity is {@link VERBOSE} or greater.
isVeryVerbose ( ) : boolean Returns whether the verbosity is {@link VERY_VERBOSE} or greater.
read ( integer $length, string $default = null ) : string Reads the given amount of characters from the standard input.
readLine ( string $default = null, integer $length = null ) : string Reads a line from the standard input.
removeFormat ( $string )
setFormatter ( Webmozart\Console\Api\Formatter\Formatter $formatter ) Sets the output formatter.
setInteractive ( boolean $interactive ) Enables or disables interaction with the user.
setQuiet ( boolean $quiet ) Sets whether all output should be suppressed.
setTerminalDimensions ( Rectangle $dimensions ) Sets the dimensions of the terminal.
setVerbosity ( integer $verbosity ) Sets the verbosity of the output.
write ( string $string, integer $flags = null ) Writes a string to the standard output.
writeLine ( string $string, integer $flags = null ) Writes a line of text to the standard output.
writeLineRaw ( string $string, integer $flags = null ) Writes a line of text to the standard output without formatting.
writeRaw ( string $string, integer $flags = null ) Writes a string to the standard output without formatting.

Protected Methods

Method Description
getDefaultTerminalDimensions ( ) : Rectangle Returns the default terminal dimensions.

Method Details

__construct() public method

Creates an I/O based on the given input and outputs.
public __construct ( Input $input, Output $output, Output $errorOutput )
$input Input The standard input.
$output Output The standard output.
$errorOutput Output The error output.

close() public method

Closes the input and the outputs.
public close ( )

error() public method

The string is formatted before it is written to the output.
public error ( string $string, integer $flags = null )
$string string The string to write.
$flags integer The flags. One of {@link VERBOSE}, {@link VERY_VERBOSE} and {@link DEBUG}.

errorLine() public method

The string is formatted before it is written to the output.
public errorLine ( string $string, integer $flags = null )
$string string The string to write. A newline is appended.
$flags integer The flags. One of {@link VERBOSE}, {@link VERY_VERBOSE} and {@link DEBUG}.

errorLineRaw() public method

Writes a line of text to the error output without formatting.
public errorLineRaw ( string $string, integer $flags = null )
$string string The string to write. A newline is appended.
$flags integer The flags. One of {@link VERBOSE}, {@link VERY_VERBOSE} and {@link DEBUG}.

errorRaw() public method

Writes a string to the error output without formatting.
public errorRaw ( string $string, integer $flags = null )
$string string The string to write.
$flags integer The flags. One of {@link VERBOSE}, {@link VERY_VERBOSE} and {@link DEBUG}.

flush() public method

Flushes the outputs and forces all pending text to be written out.
public flush ( )

format() public method

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

getDefaultTerminalDimensions() protected method

Returns the default terminal dimensions.
protected getDefaultTerminalDimensions ( ) : Rectangle
return Webmozart\Console\UI\Rectangle The terminal dimensions.

getErrorOutput() public method

Returns the error output.
public getErrorOutput ( ) : Output
return Output The error output.

getFormatter() public method

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

getInput() public method

Returns the standard input.
public getInput ( ) : Input
return Input The input.

getOutput() public method

Returns the standard output.
public getOutput ( ) : Output
return Output The output.

getTerminalDimensions() public method

Returns the dimensions of the terminal.
public getTerminalDimensions ( ) : Rectangle
return Webmozart\Console\UI\Rectangle The terminal dimensions.

getVerbosity() public method

Returns the current verbosity level.
public getVerbosity ( ) : integer
return integer One of the verbosity constants.

isDebug() public method

Returns whether the verbosity is {@link DEBUG}.
public isDebug ( ) : boolean
return boolean Returns `true` if the verbosity is {@link DEBUG} and `false` otherwise.

isInteractive() public method

Returns whether the user may be asked for input.
public isInteractive ( ) : boolean
return boolean Returns `true` if the user may be asked for input and `false` otherwise.

isQuiet() public method

Returns whether all output is suppressed.
public isQuiet ( ) : boolean
return boolean Returns `true` if all output is suppressed and `false` otherwise.

isVerbose() public method

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

isVeryVerbose() public method

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

read() public method

Reads the given amount of characters from the standard input.
public read ( integer $length, string $default = null ) : string
$length integer The number of characters to read.
$default string The default to return if interaction is disabled.
return string The characters read from the input.

readLine() public method

Reads a line from the standard input.
public readLine ( string $default = null, integer $length = null ) : string
$default string The default to return if interaction is disabled.
$length integer The maximum number of characters to read. If `null`, all characters up to the first newline are returned.
return string The characters read from the input.

removeFormat() public method

public removeFormat ( $string )

setFormatter() public method

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

setInteractive() public method

Enables or disables interaction with the user.
public setInteractive ( boolean $interactive )
$interactive boolean Whether the I/O may interact with the user. If set to `false`, all calls to {@link read()} and {@link readLine()} will immediately return the default value.

setQuiet() public method

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

setTerminalDimensions() public method

Sets the dimensions of the terminal.
public setTerminalDimensions ( Rectangle $dimensions )
$dimensions Webmozart\Console\UI\Rectangle The terminal dimensions.

setVerbosity() public method

Sets the verbosity 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 passed through.

write() public method

The string is formatted before it is written to the output.
public write ( string $string, integer $flags = null )
$string string The string to write.
$flags integer The flags. One of {@link VERBOSE}, {@link VERY_VERBOSE} and {@link DEBUG}.

writeLine() public method

The string is formatted before it is written to the output.
public writeLine ( string $string, integer $flags = null )
$string string The string to write. A newline is appended.
$flags integer The flags. One of {@link VERBOSE}, {@link VERY_VERBOSE} and {@link DEBUG}.

writeLineRaw() public method

Writes a line of text to the standard output without formatting.
public writeLineRaw ( string $string, integer $flags = null )
$string string The string to write. A newline is appended.
$flags integer The flags. One of {@link VERBOSE}, {@link VERY_VERBOSE} and {@link DEBUG}.

writeRaw() public method

Writes a string to the standard output without formatting.
public writeRaw ( string $string, integer $flags = null )
$string string The string to write.
$flags integer The flags. One of {@link VERBOSE}, {@link VERY_VERBOSE} and {@link DEBUG}.