Methods

Ask the user to select one of pre-defined options

__construct(string $promptText, array $options, bool $allowEmpty, bool $echo) 

Parameters

$promptText

string

The prompt text to display in console

$options

array

Allowed options

$allowEmpty

bool

Allow empty (no) selection?

$echo

bool

True to display selected option?

Exceptions

\Zend\Console\Exception\BadMethodCallException if no options available

getAllowEmpty()

getAllowEmpty() : bool
Inherited

inherited_from \Zend\Console\Prompt\Char::getAllowEmpty()

Returns

bool

getAllowedChars()

getAllowedChars() : string
Inherited

inherited_from \Zend\Console\Prompt\Char::getAllowedChars()

Returns

string

Return console adapter to use when showing prompt.

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

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

Returns

getEcho()

getEcho() : bool
Inherited

inherited_from \Zend\Console\Prompt\Char::getEcho()

Returns

bool

getIgnoreCase()

getIgnoreCase() : bool
Inherited

inherited_from \Zend\Console\Prompt\Char::getIgnoreCase()

Returns

bool

Return last answer to this prompt.

getLastResponse() : mixed
Inherited

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

Returns

mixed

getOptions()

getOptions() : array

Returns

array

getPromptText()

getPromptText() : string
Inherited

inherited_from \Zend\Console\Prompt\Char::getPromptText()

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()
inherited_from \Zend\Console\Prompt\Char::prompt()

Exceptions

\Zend\Console\Exception\BadMethodCallException

Returns

mixed

setAllowEmpty()

setAllowEmpty(bool $allowEmpty) 
Inherited

inherited_from \Zend\Console\Prompt\Char::setAllowEmpty()

Parameters

$allowEmpty

bool

setAllowedChars()

setAllowedChars(string $allowedChars) 
Inherited

inherited_from \Zend\Console\Prompt\Char::setAllowedChars()

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()
inherited_from \Zend\Console\Prompt\Char::setConsole()

Parameters

setEcho()

setEcho(bool $echo) 
Inherited

inherited_from \Zend\Console\Prompt\Char::setEcho()

Parameters

$echo

bool

setIgnoreCase()

setIgnoreCase(bool $ignoreCase) 
Inherited

inherited_from \Zend\Console\Prompt\Char::setIgnoreCase()

Parameters

$ignoreCase

bool

Set allowed options

setOptions(array | \Traversable $options) 

Parameters

$options

array\Traversable

Exceptions

\Zend\Console\Exception\BadMethodCallException

setPromptText()

setPromptText(string $promptText) 
Inherited

inherited_from \Zend\Console\Prompt\Char::setPromptText()

Parameters

$promptText

string

Show a list of options and prompt the user to select one of them.

show() : string

Returns

stringSelected option

 Properties

 

$allowEmpty

$allowEmpty : bool
Inherited

inherited_from \Zend\Console\Prompt\Char::$$allowEmpty
 

$allowedChars

$allowedChars : string
Inherited

inherited_from \Zend\Console\Prompt\Char::$$allowedChars
 

$console

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

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

$echo

$echo : bool
Inherited

inherited_from \Zend\Console\Prompt\Char::$$echo
 

$ignoreCase

$ignoreCase : bool

 

$lastResponse

$lastResponse : mixed
Inherited

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

$options

$options : array

 

$promptText

$promptText : string