package |
Default |
inherited_from |
\Zend\Console\Prompt\AbstractPrompt |
Methods
Ask the user to select any number of pre-defined options
__construct(string $promptText = 'Please select one option (Enter to finish) '
, array|\Zend\Console\Prompt\Transversable $options = array()
, $ignoreCase = true
, boolean $echo = false
)
Parameters
$promptText
string
The prompt text to display in console
$options
array
\Zend\Console\Prompt\Transversable
Allowed options
$ignoreCase
$echo
boolean
True to display selected option?
Return console adapter to use when showing prompt.
getConsole() : \Zend\Console\Adapter\AdapterInterface
Inherited
inherited_from |
\Zend\Console\Prompt\PromptInterface::getConsole() |
Returns
\Zend\Console\Adapter\AdapterInterface
Return last answer to this prompt.
getLastResponse() : mixed
Inherited
inherited_from |
\Zend\Console\Prompt\PromptInterface::getLastResponse() |
Returns
mixed
Create an instance of this prompt, show it and return response.
prompt() : mixed
InheritedStatic
This is a convenience method for creating statically creating prompts, i.e.:
$name = Zend\Console\Prompt\Line::prompt("Enter your name: ");
Exceptions
\Zend\Console\Exception\BadMethodCallException |
|
Returns
mixed
Set console adapter to use when showing prompt.
setConsole(\Zend\Console\Adapter\AdapterInterface $adapter)
Inherited
inherited_from |
\Zend\Console\Prompt\PromptInterface::setConsole() |
Parameters
$adapter
\Zend\Console\Adapter\AdapterInterface
Show a list of options and prompt the user to select any number of them.
show() : array
Returns
array
Checked 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
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
$lastResponse
$lastResponse : mixed
Checked options
$checkedOptions : array
If the response should be echoed to the console or not
$echo : boolean
$ignoreCase
$ignoreCase : boolean
$options
$options : array | \Zend\Console\Prompt\Transversable
$promptText
$promptText : string