Methods

Ask the user for a single key stroke

__construct(string $promptText, string $allowedChars, bool $ignoreCase, bool $allowEmpty, bool $echo) 

Parameters

$promptText

string

The prompt text to display in console

$allowedChars

string

A list of allowed chars (i.e. "abc12345")

$ignoreCase

bool

If true, case will be ignored and prompt will always return lower-cased response

$allowEmpty

bool

Is empty response allowed?

$echo

bool

Display the selection after user presses key

getAllowEmpty()

getAllowEmpty() : bool

Returns

bool

getAllowedChars()

getAllowedChars() : string

Returns

string

Return console adapter to use when showing prompt.

getConsole() : \Zend\Console\Adapter\AdapterInterface
Inherited

inherited_from \Zend\Console\Prompt\AbstractPrompt::getConsole()

Returns

getEcho()

getEcho() : bool

Returns

bool

getIgnoreCase()

getIgnoreCase() : bool

Returns

bool

Return last answer to this prompt.

getLastResponse() : mixed
Inherited

inherited_from \Zend\Console\Prompt\AbstractPrompt::getLastResponse()

Returns

mixed

getPromptText()

getPromptText() : string

Returns

string

Create an instance of this prompt, show it and return response.

prompt() : mixed
Inherited

This is a convenience method for creating statically creating prompts, i.e.:

 $name = Zend\Console\Prompt\Line::prompt("Enter your name: ");

inherited_from \Zend\Console\Prompt\AbstractPrompt::prompt()

Exceptions

\Zend\Console\Exception\BadMethodCallException

Returns

mixed

setAllowEmpty()

setAllowEmpty(bool $allowEmpty) 

Parameters

$allowEmpty

bool

setAllowedChars()

setAllowedChars(string $allowedChars) 

Parameters

$allowedChars

string

Set console adapter to use when showing prompt.

setConsole(\Zend\Console\Adapter\AdapterInterface $adapter) 
Inherited

inherited_from \Zend\Console\Prompt\AbstractPrompt::setConsole()

Parameters

setEcho()

setEcho(bool $echo) 

Parameters

$echo

bool

setIgnoreCase()

setIgnoreCase(bool $ignoreCase) 

Parameters

$ignoreCase

bool

setPromptText()

setPromptText(string $promptText) 

Parameters

$promptText

string

Show the prompt to user and return a single char.

show() : string

Returns

string

 Properties

 

$allowEmpty

$allowEmpty : bool

 

$allowedChars

$allowedChars : string

 

$console

$console : \Zend\Console\Adapter\AdapterInterface
Inherited

inherited_from \Zend\Console\Prompt\AbstractPrompt::$$console
 

$echo

$echo : bool

 

$ignoreCase

$ignoreCase : bool

 

$lastResponse

$lastResponse : mixed
Inherited

inherited_from \Zend\Console\Prompt\AbstractPrompt::$$lastResponse
 

$promptText

$promptText : string