Class ConsoleInput
Object wrapper for interacting with stdin
Properties summary
-
$_canReadline
protectedboolean
Can this instance use readline? Two conditions must be met: 1. Readline support must be enabled. 2. Handle we are attached to must be stdin. Allows rich editing with arrow keys and history when inputting a string.
-
$_input
protectedresource
Input value.
Method Summary
-
__construct() public
Constructor -
dataAvailable() public
Check if data is available on stdin -
read() public
Read a value from the stream
Method Detail
__construct() public ¶
__construct( string $handle 'php://stdin' )
Constructor
Parameters
- string $handle optional 'php://stdin'
- The location of the stream to use as input.
dataAvailable() public ¶
dataAvailable( integer $timeout 0 )
Check if data is available on stdin
Parameters
- integer $timeout optional 0
- An optional time to wait for data
Returns
boolean
True for data available, false otherwise
True for data available, false otherwise
Properties detail
$_canReadline ¶
protected
boolean
Can this instance use readline? Two conditions must be met: 1. Readline support must be enabled. 2. Handle we are attached to must be stdin. Allows rich editing with arrow keys and history when inputting a string.