1 | <?php declare(strict_types=1); |
||
10 | class FigletCaptcha implements CaptchaAdapterInterface, ValidatorInterface |
||
11 | { |
||
12 | /** @var SessionManager $session */ |
||
13 | private $session; |
||
14 | |||
15 | /** @var string $timeout */ |
||
16 | private $timeout; |
||
17 | |||
18 | /** @var string $timeout */ |
||
19 | private $length; |
||
20 | |||
21 | /** @var string $word */ |
||
22 | private $word; |
||
23 | |||
24 | /** @var array $errors */ |
||
25 | private $errors = []; |
||
26 | |||
27 | public function __construct(SessionManager $session, string $timeout = '+3 minutes', int $length = 6) |
||
34 | |||
35 | /** |
||
36 | * @return string |
||
37 | */ |
||
38 | public function generate(): string |
||
57 | |||
58 | /** |
||
59 | * @return string |
||
60 | */ |
||
61 | public function render(): string |
||
68 | |||
69 | /** |
||
70 | * @return string |
||
71 | */ |
||
72 | private function generateWord(): string |
||
82 | |||
83 | /** |
||
84 | * @param mixed $value |
||
85 | * @return bool |
||
86 | * @throws Exception If validation of $value is impossible |
||
87 | */ |
||
88 | public function isValid($value) |
||
113 | |||
114 | /** |
||
115 | * @return array |
||
116 | */ |
||
117 | public function getMessages() |
||
121 | } |
||
122 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.