Class ConsoleInput
Object wrapper for interacting with stdin
Namespace: Cake\Console
Property Summary
-
$_canReadline protected
boolCan this instance use readline? Two conditions must be met:
- Readline support must be enabled.
- Handle we are attached to must be stdin. Allows rich editing with arrow keys and history when inputting a string.
-
$_input protected
resourceInput 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 The location of the stream to use as input.
dataAvailable() ¶ public
dataAvailable(int $timeout = 0): bool
Check if data is available on stdin
Parameters
-
int$timeout optional An optional time to wait for data
Returns
boolTrue for data available, false otherwise
read() ¶ public
read(): string|null
Read a value from the stream
Returns
string|nullThe value of the stream. Null on EOF.
Property Detail
$_canReadline ¶ protected
Can this instance use readline? Two conditions must be met:
- Readline support must be enabled.
- Handle we are attached to must be stdin. Allows rich editing with arrow keys and history when inputting a string.
Type
bool