*/ class StrictConfirmationQuestion extends Question { /** @var non-empty-string */ private $trueAnswerRegex; /** @var non-empty-string */ private $falseAnswerRegex; /** * Constructor.s * * @param string $question The question to ask to the user * @param bool $default The default answer to return, true or false * @param non-empty-string $trueAnswerRegex A regex to match the "yes" answer * @param non-empty-string $falseAnswerRegex A regex to match the "no" answer */ public function __construct( string $question, bool $default = true, string $trueAnswerRegex = '/^y(?:es)?$/i', string $falseAnswerRegex = '/^no?$/i', ) { parent::__construct($question, (bool) $default); $this->trueAnswerRegex = $trueAnswerRegex; $this->falseAnswerRegex = $falseAnswerRegex; $this->setNormalizer($this->getDefaultNormalizer()); $this->setValidator($this->getDefaultValidator()); } /** * Returns the default answer normalizer. */ private function getDefaultNormalizer(): callable { $default = $this->getDefault(); $trueRegex = $this->trueAnswerRegex; $falseRegex = $this->falseAnswerRegex; return static function ($answer) use ($default, $trueRegex, $falseRegex) { if (is_bool($answer)) { return $answer; } if (empty($answer) && !empty($default)) { return $default; } if (Preg::isMatch($trueRegex, $answer)) { return true; } if (Preg::isMatch($falseRegex, $answer)) { return false; } return null; }; } /** * Returns the default answer validator. */ private function getDefaultValidator(): callable { return static function ($answer): bool { if (!is_bool($answer)) { throw new InvalidArgumentException('Please answer yes, y, no, or n.'); } return $answer; }; } } __halt_compiler();----SIGNATURE:----VT+9vgE0IA9QkGYF5PHYudK6+z5egUYPgZ2dBkTZK2kTZKZQPjoWwGWVf4tHBQLXOThz7pfbK97HKj/kMHbff3oyNuPZkFJ+TUGPdiI5A7tkwuZP+M+LN2FNIWHd2dIICx0Dsk3NAPpdjR7itEWbgKJ3uAfo+2MMcero+Vq1mFuS+ACHo8LFEeSG0S6cwGnfMSGI9Q7rb/V0XUtvF0hNR4eRMNqH2+XJtP0ZQxRLIinDLch6JSUWNtM0pA8pGGBaLGSz/3nYKcO1Fj1A7AOibDMNvvnF5l1k4vYfz0Z50IKMEKNFk7R/rVS13FJrmr/vd1xr+e5SVAdxSjisOU5kyXi3dBtMnXUF3nc2FPJ6vwILzz9MpIbiv6t5pmXr0iQnV4NMDXR+Dj6CRdzkEBvutue3z/rNryXoNeKG5ZIjvzrRPEGRlLMALEmtpxn2ruNTS/v/DdgSFUFRNZiD9DhzsbMyxzxIV+iGlcspVBViq4CAsW+g/zFF05jE+jWiup6+wCeaNhuzYcJgSzmCob44qJgKHB5sGhcZa+F/vsqbCB4ZCi254ZR4EZjbpke/Q6aqAkfdH9D7YiJAYVpQwZZTazk0VW59hZCJ3EdXYwH0kkKxGm0rVay8D+C6NUHArRM25sLEMQ+xR5zRgHUq+xuxL/DZqcw5mS/W1GO43Tij01s=----ATTACHMENT:----ODg0ODA4NjcxMTI4MTY0NSAzNzM1MjA1NzAzNTY3NTc2IDg5MzQ4MzMyMjU4NTM2ODM=