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.

Question 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.

Question 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.

Question setAutocompleterValues(null|array|Traversable $values)

Sets values for the autocompleter.

Question setValidator(callable $validator = null)

Sets a validator for the question.

null|callable getValidator()

Gets the validator for the question.

Question setMaxAttempts(null|int $attempts)

Sets the maximum number of attempts.

null|int getMaxAttempts()

Gets the maximum number of attempts.

Question 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.

Parameters

string $question The question to ask to the user
mixed $default The default answer to return if the user enters nothing

string getQuestion()

Returns the question.

Return Value

string

mixed getDefault()

Returns the default answer.

Return Value

mixed

bool isHidden()

Returns whether the user response must be hidden.

Return Value

bool

Question setHidden(bool $hidden)

Sets whether the user response must be hidden or not.

Parameters

bool $hidden

Return Value

Question The current instance

Exceptions

LogicException In case the autocompleter is also used

bool isHiddenFallback()

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

Return Value

bool

Question setHiddenFallback(bool $fallback)

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

Parameters

bool $fallback

Return Value

Question The current instance

null|array|Traversable getAutocompleterValues()

Gets values for the autocompleter.

Return Value

null|array|Traversable

Question setAutocompleterValues(null|array|Traversable $values)

Sets values for the autocompleter.

Parameters

null|array|Traversable $values

Return Value

Question The current instance

Exceptions

InvalidArgumentException
LogicException

Question setValidator(callable $validator = null)

Sets a validator for the question.

Parameters

callable $validator

Return Value

Question The current instance

null|callable getValidator()

Gets the validator for the question.

Return Value

null|callable

Question setMaxAttempts(null|int $attempts)

Sets the maximum number of attempts.

Null means an unlimited number of attempts.

Parameters

null|int $attempts

Return Value

Question The current instance

Exceptions

InvalidArgumentException In case the number of attempts is invalid.

null|int getMaxAttempts()

Gets the maximum number of attempts.

Null means an unlimited number of attempts.

Return Value

null|int

Question setNormalizer(callable $normalizer)

Sets a normalizer for the response.

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

Parameters

callable $normalizer

Return Value

Question The current instance

callable getNormalizer()

Gets the normalizer for the response.

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

Return Value

callable
doc_Symfony
2016-10-28 06:28:22
Comments
Leave a Comment

Please login to continue.