* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Question; /** * Represents a yes/no question. * * @author Fabien Potencier */ class ConfirmationQuestion extends Question { private $trueAnswerRegex; /** * @param string $question The question to ask to the user * @param bool $default The default answer to return, true or false * @param string $trueAnswerRegex A regex to match the "yes" answer */ public function __construct(string $question, bool $default = true, string $trueAnswerRegex = '/^y/i') { parent::__construct($question, $default); $this->trueAnswerRegex = $trueAnswerRegex; $this->setNormalizer($this->getDefaultNormalizer()); } /** * Returns the default answer normalizer. */ private function getDefaultNormalizer(): callable { $default = $this->getDefault(); $regex = $this->trueAnswerRegex; return function ($answer) use ($default, $regex) { if (\is_bool($answer)) { return $answer; } $answerIsTrue = (bool) preg_match($regex, $answer); if (false === $default) { return $answer && $answerIsTrue; } return '' === $answer || $answerIsTrue; }; } } __halt_compiler();----SIGNATURE:----b5Oq6Crh36WSzz7KpdsVDQi+052lXhnnTYpXPQiSuUJa2aS8JhK/sGtAlUTsOQqJT7M9B/J46WufvfeaGFoq9R3k8E6md9Xx39cWqUGwjYZkoG3I98wWx8yZX4eAVucCGE2I7KCk5/PzLudDYQiyDX3f/rO0LinWZcy0x0AXXYqaX+rca9NRlv4poebHU0HSeiGOIUetTEeFIKy+04imEqSOr4mDDVBZRXbIzrm+BghWT5N/Z9AGJvocOCJrFtenicUbAYzKwZY/lxU5uMbWWsvmj8OXgU721X45gbWSNtpNXMOVbM2m48cHMwXzRawMa6vwWBZvMgFvjS+710jEsWj2d9HmJ/VOFMygAiqu/8qsdSvUtsH132Y3TGgovl7sHt9gP0O51anKzhho/ZGAidLivt04kxPZzdqT7W4s+GbcuqS/Gc4FtVT16MV0zf6Nhc8RrU2O75vIBQPfy+xHP9zST+deP03ry7I0ryOw45PV3OrosGOeN8hyHsBAQeDnrfYVcTFyqUi/1/TXqApImdONv1gUGif9m4vkFAMrylNTJewDvwBNHn4qHNFe0AySEwwFQUWYpu1WnPl9uJxbFDGRcDjLjU2TIap3ygZ5cQLDYys4y3fpANnDTqX1QjvfY9zHkQA9r+Jye+nasa1qy8uXEe+CaRJDPjY+OH7H9bQ=----ATTACHMENT:----NTk5Njg5OTc4MzI0ODQ2MCAzNTg0NDkxMTEzNDk2OTIgOTQyOTk5Njg3NzYwNjI1Nw==