Completed
Push — master ( 08e6a3...759403 )
by John
03:07
created

functions_include.php ➔ parseBodyAsJSON()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
ccs 0
cts 4
cp 0
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
namespace LunixRESTBasics;
3
4
use Psr\Http\Message\ServerRequestInterface;
5
6
function parseBodyAsJSON(ServerRequestInterface $serverRequest): ServerRequestInterface
7
{
8
    $jsonBody = json_decode($serverRequest->getBody()->getContents(), true);
9
    return $serverRequest->withParsedBody($jsonBody);
10
}
11