Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
37 | private function guard(array $data) |
||
38 | { |
||
39 | $difference = array_diff(['jsonrpc', 'method', 'id', 'params'], array_keys($data)); |
||
40 | |||
41 | if (0 < count($difference)) { |
||
42 | throw new InvalidRequestException(sprintf('Request attributes are missed: %s', implode(', ', $difference))); |
||
43 | } |
||
44 | |||
45 | if (!is_array($data['params'])) { |
||
46 | throw new InvalidRequestException('Parameters should have an object structure'); |
||
47 | } |
||
48 | } |
||
49 | } |
||
50 |