Represents a Question.
- author Fabien Potencier
Methods |
public __construct(string $question, string|int|float|bool|?null $default = NULL)
|
public getAutocompleterCallback() : ?callable Gets the callback function used for the autocompleter. |
public getAutocompleterValues() : ?iterable Gets values for the autocompleter. |
public getDefault() : string|int|float|bool|?null Returns the default answer. |
public getMaxAttempts() : ?int Gets the maximum number of attempts. Null means an unlimited number of attempts. |
public getNormalizer() : ?callable Gets the normalizer for the response. The normalizer can ba a callable (a string), a closure or a class implementing __invoke. |
public getQuestion() : string Returns the question. |
public getValidator() : ?callable Gets the validator for the question. |
public isHidden() : bool Returns whether the user response must be hidden. |
public isHiddenFallback() : bool In case the response cannot be hidden, whether to fallback on non-hidden question or not. |
public isMultiline() : bool Returns whether the user response accepts newline characters. |
public isTrimmable() : bool |
public setAutocompleterCallback(?callable $callback) : static 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 setAutocompleterValues(?iterable $values) : static Sets values for the autocompleter.
|
public setHidden(bool $hidden) : static Sets whether the user response must be hidden or not.
|
public setHiddenFallback(bool $fallback) : static Sets whether to fallback on non-hidden question if the response cannot be hidden.
|
public setMaxAttempts(?int $attempts) : static Sets the maximum number of attempts. Null means an unlimited number of attempts.
|
public setMultiline(bool $multiline) : static Sets whether the user response should accept newline characters.
|
public setNormalizer(callable $normalizer) : static Sets a normalizer for the response. The normalizer can be a callable (a string), a closure or a class implementing __invoke.
|
public setTrimmable(bool $trimmable) : static
|
public setValidator(?callable $validator) : static Sets a validator for the question.
|
Methods |
protected isAssoc(array $array) : bool |
Properties |
private ?int $attempts = NULL |
private ?Closure $autocompleterCallback = NULL |
private string|int|float|bool|?null $default |
private bool $hidden = false |
private bool $hiddenFallback = true |
private bool $multiline = false |
private ?Closure $normalizer = NULL |
private string $question |
private bool $trimmable = true |
private ?Closure $validator = NULL |