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