Methods

Ask the user to select any number of pre-defined options

__construct(string $promptText, array | \Zend\Console\Prompt\Transversable $options, $ignoreCase, bool $echo) 

Parameters

$promptText

string

The prompt text to display in console

$options

array\Zend\Console\Prompt\Transversable

Allowed options

$ignoreCase

$echo

bool

True to display selected option?

Return console adapter to use when showing prompt.

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

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

Returns

Return last answer to this prompt.

getLastResponse() : mixed
Inherited

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

Returns

mixed

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

Set console adapter to use when showing prompt.

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

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

Parameters

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

show() : array

Returns

arrayChecked options

Check or uncheck an option

checkOrUncheckOption(string $response) 

Parameters

$response

string

Generates a mask to to be used by the readChar method.

prepareMask() : string

Returns

string

Reads a char from console.

readOption(string $mask) : string

Parameters

$mask

string

Returns

string

Set allowed options

setOptions(array | \Traversable $options) 

Parameters

$options

array\Traversable

Exceptions

\Zend\Console\Exception\InvalidArgumentException

Shows the available options with checked and unchecked states

showAvailableOptions() 

Shows the selected option to the screen

showResponse(string $response) 

Parameters

$response

string

 Properties

 

$console

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

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

$lastResponse

$lastResponse : mixed
Inherited

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

Checked options

$checkedOptions : array

 

If the response should be echoed to the console or not

$echo : bool

 

$ignoreCase

$ignoreCase : bool

 

$options

$options : array | \Zend\Console\Prompt\Transversable

 

$promptText

$promptText : string