Total Complexity | 6 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | final class ValidatorCollector implements CollectorInterface, IndexCollectorInterface |
||
14 | { |
||
15 | use CollectorTrait; |
||
16 | |||
17 | private array $validations = []; |
||
18 | |||
19 | public function getCollected(): array |
||
20 | { |
||
21 | return $this->validations; |
||
22 | } |
||
23 | |||
24 | public function collect(mixed $value, Result $result, ?iterable $rules = null): void |
||
25 | { |
||
26 | if (!$this->isActive()) { |
||
27 | return; |
||
28 | } |
||
29 | |||
30 | $this->validations[] = [ |
||
31 | 'value' => $value, |
||
32 | 'rules' => $rules instanceof Traversable ? iterator_to_array($rules, true) : (array) $rules, |
||
33 | 'result' => $result->isValid(), |
||
34 | 'errors' => $result->getErrors(), |
||
35 | ]; |
||
36 | } |
||
37 | |||
38 | private function reset(): void |
||
|
|||
39 | { |
||
40 | $this->validations = []; |
||
41 | } |
||
42 | |||
43 | public function getIndexData(): array |
||
54 | ], |
||
55 | ]; |
||
56 | } |
||
57 | } |
||
58 |
This check looks for private methods that have been defined, but are not used inside the class.