Conditions | 1 |
Paths | 1 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
41 | public function validate($data, array $context = []): ValidationResult |
||
42 | { |
||
43 | return array_reduce( |
||
44 | $this->validations, |
||
45 | function (ValidationResult $carry, Validation $validation) use ($context): ValidationResult { |
||
46 | return $carry->process( |
||
47 | /** @psalm-suppress MissingClosureParamType */ |
||
48 | function ($validData) use ($validation, $context): ValidationResult { |
||
49 | return $validation->validate($validData, $context); |
||
50 | }, |
||
51 | function () use ($carry): ValidationResult { |
||
52 | return $carry; |
||
53 | } |
||
54 | ); |
||
55 | }, |
||
56 | ValidationResult::valid($data) |
||
57 | ); |
||
60 |