Conditions | 3 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
12 | public function validate(array $data, array $rules): array |
||
13 | { |
||
14 | $errors = []; |
||
15 | foreach ($rules as $field => $fieldRules) { |
||
16 | $result = (new Rules($fieldRules))->validate(ArrayHelper::getValueByPath($data, $field)); |
||
17 | if ($result->isValid() === false) { |
||
18 | $errors[$field] = $result->getErrors(); |
||
19 | } |
||
20 | } |
||
21 | |||
22 | return $errors; |
||
23 | } |
||
25 |