Total Complexity | 6 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Coverage | 94.12% |
Changes | 0 |
1 | <?php |
||
8 | abstract class AbstractSequence implements GeneratorInterface |
||
9 | { |
||
10 | protected $sequencePool = []; |
||
11 | |||
12 | protected $translator; |
||
13 | |||
14 | 8 | public function __construct(Translator $translator) |
|
15 | { |
||
16 | 8 | $this->translator = $translator; |
|
17 | 8 | } |
|
18 | |||
19 | 4 | public function getTextCaptcha(): TextCaptcha |
|
26 | } |
||
27 | |||
28 | 4 | private function generateSequence() |
|
29 | { |
||
30 | 4 | $sequencePool = $this->sequencePool; |
|
31 | 4 | if (rand(0, 1) == 1) { |
|
32 | $sequencePool = array_reverse($sequencePool); |
||
33 | } |
||
34 | |||
35 | 4 | return array_slice($sequencePool, rand(0, count($sequencePool) - 4), 4); |
|
36 | } |
||
37 | |||
38 | 4 | private function translateSequence($sequence) |
|
46 | } |
||
47 | } |