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