Class Symfony\Component\Console\Question\Question

InheritanceSymfony\Component\Console\Question\Question
SubclassesSymfony\Component\Console\Question\ChoiceQuestion, Symfony\Component\Console\Question\ConfirmationQuestion

Represents a Question.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Constructor. Symfony\Component\Console\Question\Question
getAutocompleterValues() Gets values for the autocompleter. Symfony\Component\Console\Question\Question
getDefault() Returns the default answer. Symfony\Component\Console\Question\Question
getMaxAttempts() Gets the maximum number of attempts. Symfony\Component\Console\Question\Question
getNormalizer() Gets the normalizer for the response. Symfony\Component\Console\Question\Question
getQuestion() Returns the question. Symfony\Component\Console\Question\Question
getValidator() Gets the validator for the question. Symfony\Component\Console\Question\Question
isHidden() Returns whether the user response must be hidden. Symfony\Component\Console\Question\Question
isHiddenFallback() In case the response can not be hidden, whether to fallback on non-hidden question or not. Symfony\Component\Console\Question\Question
setAutocompleterValues() Sets values for the autocompleter. Symfony\Component\Console\Question\Question
setHidden() Sets whether the user response must be hidden or not. Symfony\Component\Console\Question\Question
setHiddenFallback() Sets whether to fallback on non-hidden question if the response can not be hidden. Symfony\Component\Console\Question\Question
setMaxAttempts() Sets the maximum number of attempts. Symfony\Component\Console\Question\Question
setNormalizer() Sets a normalizer for the response. Symfony\Component\Console\Question\Question
setValidator() Sets a validator for the question. Symfony\Component\Console\Question\Question

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
isAssoc() Symfony\Component\Console\Question\Question

Method Details

__construct() public method

Constructor.

public void __construct ( $question, $default null )
$question string

The question to ask to the user

$default mixed

The default answer to return if the user enters nothing

getAutocompleterValues() public method

Gets values for the autocompleter.

public null|array|Traversable getAutocompleterValues ( )
getDefault() public method

Returns the default answer.

public mixed getDefault ( )
getMaxAttempts() public method

Gets the maximum number of attempts.

Null means an unlimited number of attempts.

public null|int getMaxAttempts ( )
getNormalizer() public method

Gets the normalizer for the response.

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

public callable getNormalizer ( )
getQuestion() public method

Returns the question.

public string getQuestion ( )
getValidator() public method

Gets the validator for the question.

public null|callable getValidator ( )
isAssoc() protected method

protected void isAssoc ( $array )
$array
isHidden() public method

Returns whether the user response must be hidden.

public bool isHidden ( )
isHiddenFallback() public method

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

public bool isHiddenFallback ( )
setAutocompleterValues() public method

Sets values for the autocompleter.

public Symfony\Component\Console\Question\Question setAutocompleterValues ( $values )
$values null|array|Traversable
return Symfony\Component\Console\Question\Question

The current instance

throws Symfony\Component\Console\Exception\InvalidArgumentException
throws Symfony\Component\Console\Exception\LogicException
setHidden() public method

Sets whether the user response must be hidden or not.

public Symfony\Component\Console\Question\Question setHidden ( $hidden )
$hidden bool
return Symfony\Component\Console\Question\Question

The current instance

throws Symfony\Component\Console\Exception\LogicException

In case the autocompleter is also used

setHiddenFallback() public method

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

public Symfony\Component\Console\Question\Question setHiddenFallback ( $fallback )
$fallback bool
return Symfony\Component\Console\Question\Question

The current instance

setMaxAttempts() public method

Sets the maximum number of attempts.

Null means an unlimited number of attempts.

public Symfony\Component\Console\Question\Question setMaxAttempts ( $attempts )
$attempts null|int
return Symfony\Component\Console\Question\Question

The current instance

throws Symfony\Component\Console\Exception\InvalidArgumentException

In case the number of attempts is invalid.

setNormalizer() public method

Sets a normalizer for the response.

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

public Symfony\Component\Console\Question\Question setNormalizer ( callable $normalizer )
$normalizer callable
return Symfony\Component\Console\Question\Question

The current instance

setValidator() public method

Sets a validator for the question.

public Symfony\Component\Console\Question\Question setValidator ( callable $validator null )
$validator null|callable
return Symfony\Component\Console\Question\Question

The current instance