| Methods |
public
|
__construct(string $question, string|bool|int|float|null $default = null)
Parameters
| $question |
The question to ask to the user
|
| $default |
The default answer to return if the user enters nothing
|
Overriden by
|
#
|
public
|
getQuestion(): string
Returns the question.
|
#
|
public
|
getDefault(): string|bool|int|float|null
Returns the default answer.
Returns the default answer.
|
#
|
public
|
isMultiline(): bool
Returns whether the user response accepts newline characters.
Returns whether the user response accepts newline characters.
|
#
|
public
|
setMultiline(bool $multiline): $this
Sets whether the user response should accept newline characters.
Sets whether the user response should accept newline characters.
|
#
|
public
|
isHidden(): bool
Returns whether the user response must be hidden.
Returns whether the user response must be hidden.
|
#
|
public
|
setHidden(bool $hidden): $this
Sets whether the user response must be hidden or not.
Sets whether the user response must be hidden or not.
Throws
|
#
|
public
|
isHiddenFallback(): bool
In case the response cannot be hidden, whether to fallback on non-hidden question or not.
In case the response cannot be hidden, whether to fallback on non-hidden question or not.
|
#
|
public
|
setHiddenFallback(bool $fallback): $this
Sets whether to fallback on non-hidden question if the response cannot be hidden.
Sets whether to fallback on non-hidden question if the response cannot be hidden.
|
#
|
public
|
getAutocompleterValues(): ?iterable
Gets values for the autocompleter.
Gets values for the autocompleter.
|
#
|
public
|
setAutocompleterValues(?iterable $values): $this
Sets values for the autocompleter.
Sets values for the autocompleter.
Throws
|
#
|
public
|
getAutocompleterCallback(): ?callable
Gets the callback function used for the autocompleter.
Gets the callback function used for the autocompleter.
|
#
|
public
|
setAutocompleterCallback(callable $callback = null): $this
Sets the callback function used for the autocompleter.
Sets the callback function used for the autocompleter.
The callback is passed the user input as argument and should return an iterable of corresponding suggestions.
|
#
|
public
|
setValidator(callable $validator = null): $this
Sets a validator for the question.
Sets a validator for the question.
|
#
|
public
|
getValidator(): ?callable
Gets the validator for the question.
Gets the validator for the question.
|
#
|
public
|
setMaxAttempts(?int $attempts): $this
Sets the maximum number of attempts.
Sets the maximum number of attempts.
Null means an unlimited number of attempts.
Throws
|
#
|
public
|
getMaxAttempts(): ?int
Gets the maximum number of attempts.
Gets the maximum number of attempts.
Null means an unlimited number of attempts.
|
#
|
public
|
setNormalizer(callable $normalizer): $this
Sets a normalizer for the response.
Sets a normalizer for the response.
The normalizer can be a callable (a string), a closure or a class implementing __invoke.
|
#
|
public
|
getNormalizer(): ?callable
Gets the normalizer for the response.
Gets the normalizer for the response.
The normalizer can ba a callable (a string), a closure or a class implementing __invoke.
|
#
|
protected
|
isAssoc(array $array): bool
|
#
|
public
|
isTrimmable(): bool
|
#
|
public
|
setTrimmable(bool $trimmable): $this
|
#
|