Question
Question
class Question
Represents a Question.
Methods
__construct(string $question, mixed $default = null) Constructor. | ||
string | getQuestion() Returns the question. | |
mixed | getDefault() Returns the default answer. | |
bool | isHidden() Returns whether the user response must be hidden. | |
$this | setHidden(bool $hidden) Sets whether the user response must be hidden or not. | |
bool | isHiddenFallback() In case the response can not be hidden, whether to fallback on non-hidden question or not. | |
$this | setHiddenFallback(bool $fallback) Sets whether to fallback on non-hidden question if the response can not be hidden. | |
null|array|Traversable | getAutocompleterValues() Gets values for the autocompleter. | |
$this | setAutocompleterValues(null|array|Traversable $values) Sets values for the autocompleter. | |
$this | setValidator(callable $validator = null) Sets a validator for the question. | |
null|callable | getValidator() Gets the validator for the question. | |
$this | setMaxAttempts(null|int $attempts) Sets the maximum number of attempts. | |
null|int | getMaxAttempts() Gets the maximum number of attempts. | |
$this | setNormalizer(callable $normalizer) Sets a normalizer for the response. | |
callable | getNormalizer() Gets the normalizer for the response. |
Details
__construct(string $question, mixed $default = null)
Constructor.
string getQuestion()
Returns the question.
mixed getDefault()
Returns the default answer.
bool isHidden()
Returns whether the user response must be hidden.
$this setHidden(bool $hidden)
Sets whether the user response must be hidden or not.
bool isHiddenFallback()
In case the response can not be hidden, whether to fallback on non-hidden question or not.
$this setHiddenFallback(bool $fallback)
Sets whether to fallback on non-hidden question if the response can not be hidden.
null|array|Traversable getAutocompleterValues()
Gets values for the autocompleter.
$this setAutocompleterValues(null|array|Traversable $values)
Sets values for the autocompleter.
$this setValidator(callable $validator = null)
Sets a validator for the question.
null|callable getValidator()
Gets the validator for the question.
$this setMaxAttempts(null|int $attempts)
Sets the maximum number of attempts.
Null means an unlimited number of attempts.
null|int getMaxAttempts()
Gets the maximum number of attempts.
Null means an unlimited number of attempts.
$this setNormalizer(callable $normalizer)
Sets a normalizer for the response.
The normalizer can be a callable (a string), a closure or a class implementing __invoke.
callable getNormalizer()
Gets the normalizer for the response.
The normalizer can ba a callable (a string), a closure or a class implementing __invoke.
© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.1/Symfony/Component/Console/Question/Question.html