Fr3nch13/CakePHP Utilities

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
  1. Handle we are attached to must be stdin. Allows rich editing with arrow keys and history when inputting a string.

$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


        
On this page

Search results