Conditions | 4 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
39 | 29 | private function validateSingleResponse($response): void |
|
40 | { |
||
41 | 29 | if (!$response instanceof ResponseObjectInterface) { |
|
42 | 1 | throw new ResponseException( |
|
43 | 1 | sprintf( |
|
44 | 1 | 'Response from server expected to be an object or an array of objects. Given "%s".', |
|
45 | 1 | json_encode($response) |
|
46 | ) |
||
47 | ); |
||
48 | } |
||
49 | |||
50 | 28 | if ('2.0' !== $response->getProtocol()) { |
|
51 | 2 | throw new ResponseException('Invalid JSON RPC version in server request.'); |
|
52 | } |
||
53 | |||
54 | 26 | if ($response->hasError()) { |
|
55 | 8 | throw new ErrorResponseException($response->getError()); |
|
56 | } |
||
59 |