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

Public Member Functions

 __construct ($question, $default=null)
 
 getQuestion ()
 
 getDefault ()
 
 isHidden ()
 
 setHidden ($hidden)
 
 isHiddenFallback ()
 
 setHiddenFallback ($fallback)
 
 getAutocompleterValues ()
 
 setAutocompleterValues ($values)
 
 setValidator ($validator)
 
 getValidator ()
 
 setMaxAttempts ($attempts)
 
 getMaxAttempts ()
 
 setNormalizer ($normalizer)
 
 getNormalizer ()
 

Protected Member Functions

 isAssoc ($array)
 

Private Attributes

 $question
 
 $attempts
 
 $hidden = false
 
 $hiddenFallback = true
 
 $autocompleterValues
 
 $validator
 
 $default
 
 $normalizer
 

Detailed Description

Represents a Question.

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

Definition at line 19 of file Question.php.

Constructor & Destructor Documentation

__construct (   $question,
  $default = null 
)

Constructor.

Parameters
string$questionThe question to ask to the user
mixed$defaultThe default answer to return if the user enters nothing

Definition at line 36 of file Question.php.

References Question\$default, and Question\$question.

Member Function Documentation

getAutocompleterValues ( )

Gets values for the autocompleter.

Returns
null|array|

Definition at line 121 of file Question.php.

References Question\$autocompleterValues.

Referenced by QuestionHelper\autocomplete(), and QuestionHelper\doAsk().

getDefault ( )

Returns the default answer.

Returns
mixed

Definition at line 57 of file Question.php.

References Question\$default.

Referenced by QuestionHelper\ask(), QuestionHelper\doAsk(), ConfirmationQuestion\getDefaultNormalizer(), and SymfonyQuestionHelper\writePrompt().

getMaxAttempts ( )

Gets the maximum number of attempts.

Null means an unlimited number of attempts.

Returns
null|int

Definition at line 210 of file Question.php.

References Question\$attempts.

Referenced by QuestionHelper\validateAttempts().

getNormalizer ( )

Gets the normalizer for the response.

The normalizer can ba a callable (a string), a closure or a class implementing __invoke.

Returns
string|

Definition at line 238 of file Question.php.

References Question\$normalizer.

Referenced by QuestionHelper\doAsk().

getQuestion ( )

Returns the question.

Returns
string

Definition at line 47 of file Question.php.

References Question\$question.

Referenced by SymfonyQuestionHelper\writePrompt(), and QuestionHelper\writePrompt().

getValidator ( )

Gets the validator for the question.

Returns
null|callable

Definition at line 176 of file Question.php.

References Question\$validator.

Referenced by SymfonyQuestionHelper\ask(), QuestionHelper\ask(), and QuestionHelper\validateAttempts().

isAssoc (   $array)
protected
isHidden ( )

Returns whether the user response must be hidden.

Returns
bool

Definition at line 67 of file Question.php.

References Question\$hidden.

Referenced by QuestionHelper\doAsk().

isHiddenFallback ( )

In case the response can not be hidden, whether to fallback on non-hidden question or not.

Returns
bool

Definition at line 97 of file Question.php.

References Question\$hiddenFallback.

Referenced by QuestionHelper\doAsk().

setAutocompleterValues (   $values)

Sets values for the autocompleter.

Parameters
null | array | \Traversable$values
Returns
Question The current instance
Exceptions
\InvalidArgumentException
\LogicException

Definition at line 136 of file Question.php.

References Question\isAssoc().

Referenced by ChoiceQuestion\__construct().

setHidden (   $hidden)

Sets whether the user response must be hidden or not.

Parameters
bool$hidden
Returns
Question The current instance
Exceptions
\LogicExceptionIn case the autocompleter is also used

Definition at line 81 of file Question.php.

References Question\$hidden.

setHiddenFallback (   $fallback)

Sets whether to fallback on non-hidden question if the response can not be hidden.

Parameters
bool$fallback
Returns
Question The current instance

Definition at line 109 of file Question.php.

setMaxAttempts (   $attempts)

Sets the maximum number of attempts.

Null means an unlimited number of attempts.

Parameters
null | int$attempts
Returns
Question The current instance
Exceptions
\InvalidArgumentExceptionIn case the number of attempts is invalid.

Definition at line 192 of file Question.php.

References Question\$attempts.

setNormalizer (   $normalizer)

Sets a normalizer for the response.

The normalizer can be a callable (a string), a closure or a class implementing __invoke.

Parameters
string | \Closure$normalizer
Returns
Question The current instance

Definition at line 224 of file Question.php.

References Question\$normalizer.

Referenced by ConfirmationQuestion\__construct().

setValidator (   $validator)

Sets a validator for the question.

Parameters
null | callable$validator
Returns
Question The current instance

Definition at line 164 of file Question.php.

References Question\$validator.

Referenced by ChoiceQuestion\__construct(), SymfonyQuestionHelper\ask(), ChoiceQuestion\setErrorMessage(), and ChoiceQuestion\setMultiselect().

Member Data Documentation

$attempts
private

Definition at line 22 of file Question.php.

Referenced by Question\getMaxAttempts(), and Question\setMaxAttempts().

$autocompleterValues
private

Definition at line 25 of file Question.php.

Referenced by Question\getAutocompleterValues().

$default
private
$hidden = false
private

Definition at line 23 of file Question.php.

Referenced by Question\isHidden(), and Question\setHidden().

$hiddenFallback = true
private

Definition at line 24 of file Question.php.

Referenced by Question\isHiddenFallback().

$normalizer
private

Definition at line 28 of file Question.php.

Referenced by Question\getNormalizer(), and Question\setNormalizer().

$question
private
$validator
private

Definition at line 26 of file Question.php.

Referenced by Question\getValidator(), and Question\setValidator().