Conditions | 4 |
Paths | 7 |
Total Lines | 10 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
36 | private function parse(string $body): array |
||
37 | { |
||
38 | try { |
||
39 | $result = json_decode($body, true, 512, JSON_THROW_ON_ERROR); |
||
40 | return is_array($result) ? $result : []; |
||
41 | } catch (\JsonException $e) { |
||
42 | if ($this->throwException) { |
||
43 | throw new \InvalidArgumentException('Invalid JSON data in request body: ' . $e->getMessage()); |
||
44 | } |
||
45 | return []; |
||
46 | } |
||
49 |