Zend Framework  3.0
Public Member Functions | Protected Attributes | List of all members
Select Class Reference

Public Member Functions

 __construct ($promptText= 'Please select one option', $options=[], $allowEmpty=false, $echo=false)
 Ask the user to select one of pre-defined options.
 
 show ()
 Show a list of options and prompt the user to select one of them.
 
 setOptions ($options)
 Set allowed options.
 
 getOptions ()
 
- Public Member Functions inherited from Char
 __construct ($promptText= 'Please hit a key', $allowedChars= '0123456789abcdefghijklmnopqrstuvwxyz', $ignoreCase=true, $allowEmpty=false, $echo=true)
 Ask the user for a single key stroke.
 
 show ()
 Show the prompt to user and return a single char.
 
 setAllowEmpty ($allowEmpty)
 
 getAllowEmpty ()
 
 setPromptText ($promptText)
 
 getPromptText ()
 
 setAllowedChars ($allowedChars)
 
 getAllowedChars ()
 
 setIgnoreCase ($ignoreCase)
 
 getIgnoreCase ()
 
 setEcho ($echo)
 
 getEcho ()
 
- Public Member Functions inherited from AbstractPrompt
 getLastResponse ()
 Return last answer to this prompt.
 
 getConsole ()
 Return console adapter to use when showing prompt.
 
 setConsole (ConsoleAdapter $adapter)
 Set console adapter to use when showing prompt.
 

Protected Attributes

 $promptText = 'Please select an option'
 
 $ignoreCase = true
 
 $options = []
 
- Protected Attributes inherited from Char
 $promptText
 
 $allowEmpty
 
 $allowedChars
 
 $ignoreCase
 
 $echo
 
- Protected Attributes inherited from AbstractPrompt
 $console
 
 $lastResponse
 

Additional Inherited Members

- Static Public Member Functions inherited from AbstractPrompt
static prompt ()
 Create an instance of this prompt, show it and return response.
 

Constructor & Destructor Documentation

__construct (   $promptText = 'Please select one option',
  $options = [],
  $allowEmpty = false,
  $echo = false 
)

Ask the user to select one of pre-defined options.

Parameters
string$promptTextThe prompt text to display in console
array$optionsAllowed options
bool$allowEmptyAllow empty (no) selection?
bool$echoTrue to display selected option?
Exceptions
Exception\BadMethodCallExceptionif no options available

Member Function Documentation

getOptions ( )
Returns
array
setOptions (   $options)

Set allowed options.

Parameters
array | \Traversable$options
Exceptions
Exception\BadMethodCallException
show ( )

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

Returns
string Selected option

Implements PromptInterface.

Member Data Documentation

$ignoreCase = true
protected
$options = []
protected
$promptText = 'Please select an option'
protected