This commit is contained in:
1 parent
f7c532a648
commit
640bd67556
5801 files changed
+484532
-55857
No files matched your search
+41
-2
@@ -24,11 +24,21 @@ class Question
|
||||
private ?int $attempts = null;
|
||||
private bool $hidden = false;
|
||||
private bool $hiddenFallback = true;
|
||||
/**
|
||||
* @var (\Closure(string):string[])|null
|
||||
*/
|
||||
private ?\Closure $autocompleterCallback = null;
|
||||
/**
|
||||
* @var (\Closure(mixed):mixed)|null
|
||||
*/
|
||||
private ?\Closure $validator = null;
|
||||
/**
|
||||
* @var (\Closure(mixed):mixed)|null
|
||||
*/
|
||||
private ?\Closure $normalizer = null;
|
||||
private bool $trimmable = true;
|
||||
private bool $multiline = false;
|
||||
private ?int $timeout = null;
|
||||
|
||||
/**
|
||||
* @param string $question The question to ask to the user
|
||||
@@ -76,6 +86,27 @@ class Question
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the timeout in seconds.
|
||||
*/
|
||||
public function getTimeout(): ?int
|
||||
{
|
||||
return $this->timeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the maximum time the user has to answer the question.
|
||||
* If the user does not answer within this time, an exception will be thrown.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTimeout(?int $seconds): static
|
||||
{
|
||||
$this->timeout = $seconds;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the user response must be hidden.
|
||||
*/
|
||||
@@ -160,6 +191,8 @@ class Question
|
||||
|
||||
/**
|
||||
* Gets the callback function used for the autocompleter.
|
||||
*
|
||||
* @return (callable(string):string[])|null
|
||||
*/
|
||||
public function getAutocompleterCallback(): ?callable
|
||||
{
|
||||
@@ -171,6 +204,8 @@ class Question
|
||||
*
|
||||
* The callback is passed the user input as argument and should return an iterable of corresponding suggestions.
|
||||
*
|
||||
* @param (callable(string):string[])|null $callback
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAutocompleterCallback(?callable $callback): static
|
||||
@@ -187,6 +222,8 @@ class Question
|
||||
/**
|
||||
* Sets a validator for the question.
|
||||
*
|
||||
* @param (callable(mixed):mixed)|null $validator
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setValidator(?callable $validator): static
|
||||
@@ -198,6 +235,8 @@ class Question
|
||||
|
||||
/**
|
||||
* Gets the validator for the question.
|
||||
*
|
||||
* @return (callable(mixed):mixed)|null
|
||||
*/
|
||||
public function getValidator(): ?callable
|
||||
{
|
||||
@@ -237,7 +276,7 @@ class Question
|
||||
/**
|
||||
* Sets a normalizer for the response.
|
||||
*
|
||||
* The normalizer can be a callable (a string), a closure or a class implementing __invoke.
|
||||
* @param callable(mixed):mixed $normalizer
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
@@ -251,7 +290,7 @@ class Question
|
||||
/**
|
||||
* Gets the normalizer for the response.
|
||||
*
|
||||
* The normalizer can ba a callable (a string), a closure or a class implementing __invoke.
|
||||
* @return (callable(mixed):mixed)|null
|
||||
*/
|
||||
public function getNormalizer(): ?callable
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user