| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | public function parse($content) |
||
| 17 | { |
||
| 18 | $data = json_decode($content, true); |
||
| 19 | if (0 !== json_last_error()) { |
||
| 20 | throw new ParseException(sprintf('Invalid JSON syntax: "%s"', json_last_error_msg())); |
||
| 21 | } |
||
| 22 | |||
| 23 | if (!is_array($data)) { |
||
| 24 | throw new InvalidRequestException('Request is not valid JSON'); |
||
| 25 | } |
||
| 26 | |||
| 27 | $this->guard($data); |
||
| 28 | |||
| 29 | return new Request($data['jsonrpc'], $data['id'], $data['method'], $data['params']); |
||
| 30 | } |
||
| 31 | |||
| 50 |