TYPO3  7.6
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ChoiceQuestion Class Reference
Inheritance diagram for ChoiceQuestion:
Question

Public Member Functions

 __construct ($question, array $choices, $default=null)
 
 getChoices ()
 
 setMultiselect ($multiselect)
 
 getPrompt ()
 
 setPrompt ($prompt)
 
 setErrorMessage ($errorMessage)
 
- Public Member Functions inherited from Question
 __construct ($question, $default=null)
 
 getQuestion ()
 
 getDefault ()
 
 isHidden ()
 
 setHidden ($hidden)
 
 isHiddenFallback ()
 
 setHiddenFallback ($fallback)
 
 getAutocompleterValues ()
 
 setAutocompleterValues ($values)
 
 setValidator ($validator)
 
 getValidator ()
 
 setMaxAttempts ($attempts)
 
 getMaxAttempts ()
 
 setNormalizer ($normalizer)
 
 getNormalizer ()
 

Private Member Functions

 getDefaultValidator ()
 

Private Attributes

 $choices
 
 $multiselect = false
 
 $prompt = ' > '
 
 $errorMessage = 'Value "%s" is invalid'
 

Additional Inherited Members

- Protected Member Functions inherited from Question
 isAssoc ($array)
 

Detailed Description

Represents a choice question.

Author
Fabien Potencier fabie.nosp@m.n@sy.nosp@m.mfony.nosp@m..com

Definition at line 19 of file ChoiceQuestion.php.

Constructor & Destructor Documentation

__construct (   $question,
array  $choices,
  $default = null 
)

Constructor.

Parameters
string$questionThe question to ask to the user
array$choicesThe list of available choices
mixed$defaultThe default answer to return

Definition at line 33 of file ChoiceQuestion.php.

References ChoiceQuestion\$choices, Question\$default, Question\$question, ChoiceQuestion\getDefaultValidator(), Question\setAutocompleterValues(), and Question\setValidator().

Member Function Documentation

getChoices ( )

Returns available choices.

Returns
array

Definition at line 47 of file ChoiceQuestion.php.

References ChoiceQuestion\$choices.

getDefaultValidator ( )
private
getPrompt ( )

Gets the prompt for choices.

Returns
string

Definition at line 74 of file ChoiceQuestion.php.

References ChoiceQuestion\$prompt.

setErrorMessage (   $errorMessage)

Sets the error message for invalid values.

The error message has a string placeholder (s) for the invalid value.

Parameters
string$errorMessage
Returns
ChoiceQuestion The current instance

Definition at line 102 of file ChoiceQuestion.php.

References ChoiceQuestion\$errorMessage, ChoiceQuestion\getDefaultValidator(), and Question\setValidator().

setMultiselect (   $multiselect)

Sets multiselect option.

When multiselect is set to true, multiple choices can be answered.

Parameters
bool$multiselect
Returns
ChoiceQuestion The current instance

Definition at line 61 of file ChoiceQuestion.php.

References ChoiceQuestion\$multiselect, ChoiceQuestion\getDefaultValidator(), and Question\setValidator().

setPrompt (   $prompt)

Sets the prompt for choices.

Parameters
string$prompt
Returns
ChoiceQuestion The current instance

Definition at line 86 of file ChoiceQuestion.php.

References ChoiceQuestion\$prompt.

Member Data Documentation

$choices
private
$errorMessage = 'Value "%s" is invalid'
private
$multiselect = false
private
$prompt = ' > '
private

Definition at line 23 of file ChoiceQuestion.php.

Referenced by ChoiceQuestion\getPrompt(), and ChoiceQuestion\setPrompt().