| Total Complexity | 9 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | final class ValidatorFactory implements ValidatorFactoryInterface |
||
| 10 | { |
||
| 11 | private ?FormatterInterface $formatter; |
||
| 12 | |||
| 13 | 3 | public function __construct( |
|
| 14 | FormatterInterface $formatter = null |
||
| 15 | ) { |
||
| 16 | 3 | $this->formatter = $formatter; |
|
| 17 | 3 | } |
|
| 18 | |||
| 19 | 3 | public function create(array $rules): ValidatorInterface |
|
| 20 | { |
||
| 21 | 3 | return new Validator($this->normalizeRules($rules)); |
|
| 22 | } |
||
| 23 | |||
| 24 | 3 | private function normalizeRules(array $rules) |
|
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @param callable|Rule $rule |
||
| 37 | */ |
||
| 38 | 3 | private function normalizeRule($rule): Rule |
|
| 55 | } |
||
| 56 | } |
||
| 57 |