| Total Complexity | 6 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | class Captcha extends Element implements Ruleable, Descriptionable |
||
| 15 | { |
||
| 16 | use Traits\Description; |
||
| 17 | use Traits\Rules; |
||
| 18 | |||
| 19 | |||
| 20 | /** |
||
| 21 | * @param CaptchaInterface $captcha |
||
| 22 | * @param string|null $message |
||
| 23 | */ |
||
| 24 | public function __construct(private CaptchaInterface $captcha, string $message = null) |
||
| 28 | } |
||
| 29 | |||
| 30 | public function prepare() |
||
| 31 | { |
||
| 32 | $this->captcha->setRequest($this->getRequest()); |
||
| 33 | $this->addRule(Rules::CAPTCHA, $this->captcha->getRuleMessage()); |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * |
||
| 38 | * @return string |
||
| 39 | */ |
||
| 40 | public function renderHtml(): string |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * |
||
| 47 | * @return bool |
||
| 48 | */ |
||
| 49 | public function validate(): bool |
||
| 50 | { |
||
| 51 | return $this->captcha->validate($this); |
||
| 52 | } |
||
| 53 | |||
| 54 | |||
| 55 | public function baseHtml(): string |
||
| 56 | { |
||
| 57 | return $this->renderHtml(); |
||
| 58 | } |
||
| 59 | |||
| 60 | public function getCaptcha(): CaptchaInterface |
||
| 63 | } |
||
| 64 | } |
||
| 65 |