Completed
Push — master ( e6719d...13ae3c )
by John
01:53
created

JSONBodyParser::parse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 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
    public function parse(string $rawBody): RequestData {
17
        return new JSONRequestData($rawBody);
18
    }
19
}
20