/** * {@inheritDoc} */ public function requestSolutionForCaptcha(CaptchaInterface $captcha) { if ($captcha instanceof FilesystemImageCaptcha || $captcha instanceof Base64Captcha) { return parent::requestSolutionForCaptcha($captcha); } throw new \InvalidArgumentException(sprintf('`$captcha` deve ser uma instância de `%s` ou `%s`, `%s` foi dado', FilesystemImageCaptcha::class, Base64Captcha::class, gettype($captcha))); }
/** * {@inheritDoc} */ public function requestSolutionForCaptcha(CaptchaInterface $captcha) { try { return parent::requestSolutionForCaptcha($captcha); } catch (ServerException $e) { throw new ServiceTemporarilyOverloadedException(); } }
/** * {@inheritDoc} * @param FilesystemImageCaptcha $captcha */ public function requestSolutionForCaptcha(CaptchaInterface $captcha) { if ($captcha instanceof FilesystemImageCaptcha) { $base64 = base64_encode(file_get_contents($captcha->getPath())); unlink($captcha->getPath()); $captcha = Base64Captcha::fromString($base64); } return parent::requestSolutionForCaptcha($captcha); }