Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
28 | 3 | public function validate(ValidateParamsEvent $event) |
|
29 | { |
||
30 | 3 | $method = $event->getMethod(); |
|
31 | 3 | if (!$method instanceof MethodWithValidatedParams) { |
|
32 | 1 | return; |
|
33 | } |
||
34 | 2 | foreach ($this->validator->validate($event->getParamList(), $method->getParamsConstraint()) as $violation) { |
|
35 | /** @var ConstraintViolationInterface $violation */ |
||
36 | 1 | $event->addViolation([ |
|
37 | 1 | 'path' => $violation->getPropertyPath(), |
|
38 | 1 | 'message' => $violation->getMessage(), |
|
39 | 1 | 'code' => $violation->getCode(), |
|
40 | ]); |
||
44 |