Conditions | 2 |
Paths | 2 |
Total Lines | 9 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 2.032 |
Changes | 0 |
1 | <?php declare(strict_types = 1); |
||
32 | 2 | private function parseBody(ServerRequestInterface $request) : array |
|
33 | { |
||
34 | 2 | $parsedBody = json_decode($request->getBody()->getContents(), true); |
|
35 | 2 | if (json_last_error() !== JSON_ERROR_NONE) { |
|
36 | throw new \InvalidArgumentException('Could not decode JSON body: ' . json_last_error_msg()); |
||
37 | } |
||
38 | |||
39 | 2 | return $parsedBody; |
|
40 | } |
||
41 | } |