1 | <?php |
||
11 | class BodyParser extends Resolver |
||
12 | { |
||
13 | /** @var mixed[] */ |
||
14 | private $options = [ |
||
15 | // When true, returned objects will be converted into associative arrays. |
||
16 | 'forceArray' => true, |
||
17 | ]; |
||
18 | |||
19 | /** |
||
20 | * BodyParser constructor. |
||
21 | * |
||
22 | * @param mixed[] $options |
||
23 | */ |
||
24 | public function __construct(array $options = []) |
||
31 | |||
32 | /** |
||
33 | * @param string $id |
||
34 | * |
||
35 | * @return callable|null |
||
36 | */ |
||
37 | public function resolve($id) |
||
45 | |||
46 | /** |
||
47 | * JSON parser. |
||
48 | * |
||
49 | * @param StreamInterface $body |
||
50 | * |
||
51 | * @return array|object Returns an array when $assoc is true, and an object when $assoc is false |
||
52 | */ |
||
53 | public function json(StreamInterface $body) |
||
71 | |||
72 | /** |
||
73 | * Parses url-encoded strings. |
||
74 | * |
||
75 | * @param StreamInterface $body |
||
76 | * |
||
77 | * @return array |
||
78 | */ |
||
79 | public function urlencode(StreamInterface $body) |
||
85 | |||
86 | /** |
||
87 | * Parses csv strings. |
||
88 | * |
||
89 | * @param StreamInterface $body |
||
90 | * |
||
91 | * @return array |
||
92 | */ |
||
93 | public function csv(StreamInterface $body) |
||
110 | } |
||
111 |