| Conditions | 5 |
| Paths | 5 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 5 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 38 | 8 | public function parse(string $rawBody) |
|
| 39 | { |
||
| 40 | 8 | if ($rawBody === '') { |
|
| 41 | 1 | return null; |
|
| 42 | } |
||
| 43 | |||
| 44 | try { |
||
| 45 | /** @var mixed $result */ |
||
| 46 | 7 | $result = json_decode($rawBody, $this->convertToAssociativeArray, $this->depth, $this->options); |
|
| 47 | 4 | if (is_array($result) || is_object($result)) { |
|
| 48 | 4 | return $result; |
|
| 49 | } |
||
| 50 | 3 | } catch (JsonException $e) { |
|
| 51 | 3 | throw new ParserException('Invalid JSON data in request body: ' . $e->getMessage()); |
|
| 52 | } |
||
| 53 | |||
| 54 | 2 | return null; |
|
| 55 | } |
||
| 57 |