1 | <?php |
||
29 | class JsonParser implements RequestParserInterface |
||
30 | { |
||
31 | /** |
||
32 | * @var boolean whether to return objects in terms of associative arrays. |
||
33 | */ |
||
34 | public $asArray = true; |
||
35 | /** |
||
36 | * @var boolean whether to throw a [[BadRequestHttpException]] if the body is invalid json |
||
37 | */ |
||
38 | public $throwException = true; |
||
39 | |||
40 | |||
41 | /** |
||
42 | * Parses a HTTP request body. |
||
43 | * @param string $rawBody the raw HTTP request body. |
||
44 | * @param string $contentType the content type specified for the request body. |
||
45 | * @return array parameters parsed from the request body |
||
46 | * @throws BadRequestHttpException if the body contains invalid json and [[throwException]] is `true`. |
||
47 | */ |
||
48 | public function parse($rawBody, $contentType) |
||
60 | } |
||
61 |