Conditions | 6 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | protected function parsedBody(ServerRequestInterface $srq) : void |
||
19 | { |
||
20 | $srm = $srq->getMethod(); |
||
21 | |||
22 | if ($srm === 'GET' || $srm === 'HEAD' || $srm === 'OPTIONS') { |
||
23 | return; |
||
24 | } |
||
25 | |||
26 | switch ($srq->getHeaderLine('Content-Type')) { |
||
27 | case 'application/json': |
||
28 | $srq->withParsedBody(json_decode((string)$srq->getBody(), true)); |
||
29 | break; |
||
30 | case 'application/x-www-form-urlencoded': |
||
31 | parse_str((string)$srq->getBody(), $posted); |
||
32 | $srq->withParsedBody($posted); |
||
33 | break; |
||
34 | } |
||
37 |