| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 41 | 10 | private function body(ServerRequestInterface $request) |
|
| 42 | { |
||
| 43 | 10 | $body = $request->getParsedBody(); |
|
| 44 | |||
| 45 | 10 | if (empty($body)) { |
|
| 46 | 8 | return []; |
|
| 47 | } |
||
| 48 | |||
| 49 | 3 | if (is_object($body)) { |
|
| 50 | // Because the parsed body may also be represented as an object, |
||
| 51 | // additional parsing is required. This is a bit dirty but works |
||
| 52 | // very well for anonymous objects. |
||
| 53 | 1 | $body = json_decode(json_encode($body), true); |
|
| 54 | 1 | } |
|
| 55 | |||
| 56 | 3 | return $body; |
|
| 57 | } |
||
| 58 | } |
||
| 59 |