Completed
Push — master ( 005b00...a8a0a1 )
by John
01:59
created

JSONBodyParser::parse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
namespace LunixREST\Request\BodyParser;
3
4
use LunixREST\Request\BodyParser\Exceptions\InvalidRequestDataException;
5
use LunixREST\Request\RequestData\JSONRequestData;
6
use LunixREST\Request\RequestData\RequestData;
7
8
class JSONBodyParser implements BodyParser {
9
10
    /**
11
     * Parses API request data out of a json string
12
     * @param $rawBody
13
     * @return RequestData
14
     * @throws InvalidRequestDataException
15
     */
16 8
    public function parse(string $rawBody): RequestData {
17 8
        return new JSONRequestData($rawBody);
18
    }
19
}
20