checkMailCode($key, $code); } elseif (CommonValidator::phone($key)) { $result = $verifyCodeService->checkSmsCode($key, $code); } if (!$result) { throw new BadRequestException('security.invalid_verify_code'); } } public function checkCaptchaCode($ticket, $rand) { $captchaService = new CaptchaService(); $result = $captchaService->verify($ticket, $rand); if (!$result) { throw new BadRequestException('security.invalid_captcha_code'); } } }