public function DialogHelper::askHiddenResponseAndValidate in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/console/Helper/DialogHelper.php \Symfony\Component\Console\Helper\DialogHelper::askHiddenResponseAndValidate()
Asks for a value, hide and validates the response.
The validator receives the data to validate. It must return the validated data when the data is valid and throw an exception otherwise.
Parameters
OutputInterface $output An Output instance:
string|array $question The question to ask:
callable $validator A PHP callback:
int|false $attempts Max number of times to ask before giving up (false by default, which means infinite):
bool $fallback In case the response can not be hidden, whether to fallback on non-hidden question or not:
Return value
string The response
Throws
\Exception When any of the validators return an error
\RuntimeException In case the fallback is deactivated and the response can not be hidden
File
- vendor/
symfony/ console/ Helper/ DialogHelper.php, line 376
Class
- DialogHelper
- The Dialog class provides helpers to interact with the user.
Namespace
Symfony\Component\Console\HelperCode
public function askHiddenResponseAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $fallback = true) {
$that = $this;
$interviewer = function () use ($output, $question, $fallback, $that) {
return $that
->askHiddenResponse($output, $question, $fallback);
};
return $this
->validateAttempts($interviewer, $output, $validator, $attempts);
}