Class Input
The console input.
This class wraps an input stream and adds convenience functionality for
reading that stream.
Methods summary
public
|
|
public
string
|
#
read( integer $length, string $default = null )
Reads the given amount of characters from the input stream.
Reads the given amount of characters from the input stream.
Parameters
- $length
- The number of characters to read.
- $default
- The default to return if interaction is disabled.
Returns
string The characters read from the input stream.
Throws
|
public
string
|
#
readLine( string $default = null, integer $length = null )
Reads a line from the input stream.
Reads a line from the input stream.
Parameters
- $default
- The default to return if interaction is disabled.
- $length
The maximum number of characters to read. If
null , all characters up to the first newline are
returned.
Returns
string The characters read from the input stream.
Throws
|
public
|
|
public
boolean
|
#
isClosed( )
Returns whether the input is closed.
Returns whether the input is closed.
Returns
boolean Returns true if the input is closed and false
otherwise.
|
public
|
|
public
Webmozart\Console\Api\IO\InputStream
|
#
getStream( )
Returns the underlying stream.
Returns the underlying stream.
Returns
|
public
|
#
setInteractive( boolean $interactive )
Enables or disables interaction with the user.
Enables or disables interaction with the user.
Parameters
|
public
boolean
|
#
isInteractive( )
Returns whether the user may be asked for input.
Returns whether the user may be asked for input.
Returns
boolean Returns true if the user may be asked for input and
false otherwise.
|