StubConsoleInput
extends ConsoleInput
in package
Stub class used by the console integration harness.
This class enables input to be stubbed and have exceptions raised when no answer is available.
Table of Contents
Properties
- $_canReadline : bool
- Can this instance use readline? Two conditions must be met: 1. Readline support must be enabled.
- $_input : resource
- Input value.
- $currentIndex : int
- Current message index
- $replies : array<string|int, string>
- Reply values for ask() and askChoice()
Methods
- __construct() : mixed
- Constructor
- dataAvailable() : bool
- Check if data is available on stdin
- read() : string
- Read a reply
Properties
$_canReadline
Can this instance use readline? Two conditions must be met: 1. Readline support must be enabled.
protected
bool
$_canReadline
- Handle we are attached to must be stdin. Allows rich editing with arrow keys and history when inputting a string.
$_input
Input value.
protected
resource
$_input
$currentIndex
Current message index
protected
int
$currentIndex
= -1
$replies
Reply values for ask() and askChoice()
protected
array<string|int, string>
$replies
= []
Methods
__construct()
Constructor
public
__construct(array<string|int, string> $replies) : mixed
Parameters
- $replies : array<string|int, string>
-
A list of replies for read()
dataAvailable()
Check if data is available on stdin
public
dataAvailable([int $timeout = 0 ]) : bool
Parameters
- $timeout : int = 0
-
An optional time to wait for data
Return values
bool —True for data available, false otherwise
read()
Read a reply
public
read() : string
Return values
string —The value of the reply