Conditions | 3 |
Paths | 3 |
Total Lines | 21 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 15 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
27 | 9 | public function validate(JsonRpcRequest $jsonRpcRequest, JsonRpcMethodInterface $method) : array |
|
28 | { |
||
29 | 9 | $violationList = []; |
|
30 | 9 | if (!$method instanceof MethodWithValidatedParamsInterface) { |
|
31 | 3 | return $violationList; |
|
32 | } |
||
33 | 6 | $sfViolationList = $this->validator->validate( |
|
34 | 6 | $jsonRpcRequest->getParamList(), |
|
35 | 6 | $method->getParamsConstraint() |
|
36 | 6 | ); |
|
37 | |||
38 | 6 | foreach ($sfViolationList as $violation) { |
|
39 | /** @var ConstraintViolationInterface $violation */ |
||
40 | 3 | $violationList[] = [ |
|
41 | 3 | 'path' => $violation->getPropertyPath(), |
|
42 | 3 | 'message' => $violation->getMessage(), |
|
43 | 3 | 'code' => $violation->getCode(), |
|
44 | 3 | ]; |
|
45 | } |
||
46 | |||
47 | 6 | return $violationList; |
|
48 | } |
||
50 |