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