| Conditions | 7 |
| Paths | 6 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 48 | private function parse(string $body) |
||
| 49 | { |
||
| 50 | try { |
||
| 51 | $result = json_decode($body, $this->assoc, 512, JSON_THROW_ON_ERROR | JSON_INVALID_UTF8_IGNORE); |
||
| 52 | if (($this->assoc === true && is_array($result)) || ($this->assoc === false && is_object($result))) { |
||
| 53 | return $result; |
||
| 54 | } |
||
| 55 | } catch (\JsonException $e) { |
||
| 56 | if ($this->throwException) { |
||
| 57 | throw new \InvalidArgumentException('Invalid JSON data in request body: ' . $e->getMessage()); |
||
| 58 | } |
||
| 59 | } |
||
| 60 | return null; |
||
| 61 | } |
||
| 63 |