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); |
||
41 | 4 | private function parseBody(ServerRequestInterface $request) : array |
|
42 | { |
||
43 | 4 | $parsedBody = json_decode($request->getBody()->getContents(), true); |
|
44 | 4 | if (json_last_error() !== JSON_ERROR_NONE) { |
|
45 | 1 | throw new \InvalidArgumentException('Could not decode JSON body: ' . json_last_error_msg()); |
|
46 | } |
||
47 | |||
48 | 3 | return $parsedBody; |
|
49 | } |
||
51 |