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