Properties

$question

$question : 

Type

$attempts

$attempts : 

Type

$hidden

$hidden : 

Type

$hiddenFallback

$hiddenFallback : 

Type

$autocompleterValues

$autocompleterValues : 

Type

$validator

$validator : 

Type

$default

$default : 

Type

$normalizer

$normalizer : 

Type

Methods

__construct()

__construct(string  $question, mixed  $default = null) 

Parameters

string $question

The question to ask to the user

mixed $default

The default answer to return if the user enters nothing

getQuestion()

getQuestion() : string

Returns the question.

Returns

string

getDefault()

getDefault() : mixed

Returns the default answer.

Returns

mixed

isHidden()

isHidden() : boolean

Returns whether the user response must be hidden.

Returns

boolean

setHidden()

setHidden(boolean  $hidden) : $this

Sets whether the user response must be hidden or not.

Parameters

boolean $hidden

Throws

\Symfony\Component\Console\Exception\LogicException

In case the autocompleter is also used

Returns

$this

isHiddenFallback()

isHiddenFallback() : boolean

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

Returns

boolean

setHiddenFallback()

setHiddenFallback(boolean  $fallback) : $this

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

Parameters

boolean $fallback

Returns

$this

getAutocompleterValues()

getAutocompleterValues() : \Symfony\Component\Console\Question\iterable|null

Gets values for the autocompleter.

Returns

\Symfony\Component\Console\Question\iterable|null

setAutocompleterValues()

setAutocompleterValues(\Symfony\Component\Console\Question\iterable|null  $values) : $this

Sets values for the autocompleter.

Parameters

\Symfony\Component\Console\Question\iterable|null $values

Throws

\Symfony\Component\Console\Exception\InvalidArgumentException
\Symfony\Component\Console\Exception\LogicException

Returns

$this

setValidator()

setValidator(callable|null  $validator = null) : $this

Sets a validator for the question.

Parameters

callable|null $validator

Returns

$this

getValidator()

getValidator() : callable|null

Gets the validator for the question.

Returns

callable|null

setMaxAttempts()

setMaxAttempts(integer|null  $attempts) : $this

Sets the maximum number of attempts.

Null means an unlimited number of attempts.

Parameters

integer|null $attempts

Throws

\Symfony\Component\Console\Exception\InvalidArgumentException

in case the number of attempts is invalid

Returns

$this

getMaxAttempts()

getMaxAttempts() : integer|null

Gets the maximum number of attempts.

Null means an unlimited number of attempts.

Returns

integer|null

setNormalizer()

setNormalizer(callable  $normalizer) : $this

Sets a normalizer for the response.

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

Parameters

callable $normalizer

Returns

$this

getNormalizer()

getNormalizer() : callable

Gets the normalizer for the response.

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

Returns

callable

isAssoc()

isAssoc(  $array) 

Parameters

$array