1 | <?php |
||
7 | class ServerRequest extends Request implements ServerRequestInterface |
||
8 | { |
||
9 | |||
10 | /** |
||
11 | * @var |
||
12 | */ |
||
13 | protected $serverParams; |
||
14 | |||
15 | /** |
||
16 | * @var |
||
17 | */ |
||
18 | protected $cookieParams; |
||
19 | |||
20 | /** |
||
21 | * @var |
||
22 | */ |
||
23 | protected $queryParams; |
||
24 | |||
25 | /** |
||
26 | * @var |
||
27 | */ |
||
28 | protected $uploadedFiles; |
||
29 | |||
30 | /** |
||
31 | * @var |
||
32 | */ |
||
33 | protected $parsedBody; |
||
34 | |||
35 | /** |
||
36 | * @var |
||
37 | */ |
||
38 | protected $attributes = []; |
||
39 | |||
40 | /** |
||
41 | * ServerRequest constructor. |
||
42 | * @param string $uri |
||
43 | * @param string $method |
||
44 | * @param array $server |
||
45 | */ |
||
46 | 27 | public function __construct($uri = '/', $method = 'GET', $server = []) |
|
51 | |||
52 | /** |
||
53 | * @param string $uri |
||
54 | * @param string $method |
||
55 | * @return static |
||
56 | */ |
||
57 | 16 | public static function create($uri = '/', $method = 'GET') |
|
87 | |||
88 | /** |
||
89 | * {@inheritdoc} |
||
90 | * |
||
91 | * @return array |
||
92 | */ |
||
93 | 1 | public function getServerParams() |
|
97 | |||
98 | /** |
||
99 | * {@inheritdoc} |
||
100 | * |
||
101 | * @return array |
||
102 | */ |
||
103 | 1 | public function getCookieParams() |
|
107 | |||
108 | /** |
||
109 | * {@inheritdoc} |
||
110 | * |
||
111 | * @param array $cookies Array of key/value pairs representing cookies. |
||
112 | * @return self |
||
113 | */ |
||
114 | 17 | public function withCookieParams(array $cookies) |
|
118 | |||
119 | /** |
||
120 | * {@inheritdoc} |
||
121 | * |
||
122 | * @return array |
||
123 | */ |
||
124 | 3 | public function getQueryParams() |
|
128 | |||
129 | /** |
||
130 | * {@inheritdoc} |
||
131 | * |
||
132 | * @param array $query Array of query string arguments, typically from |
||
133 | * $_GET. |
||
134 | * @return self |
||
135 | */ |
||
136 | 17 | public function withQueryParams(array $query) |
|
140 | |||
141 | /** |
||
142 | * {@inheritdoc} |
||
143 | * |
||
144 | * @return array An array tree of UploadedFileInterface instances; an empty |
||
145 | * array MUST be returned if no data is present. |
||
146 | */ |
||
147 | 1 | public function getUploadedFiles() |
|
151 | |||
152 | /** |
||
153 | * {@inheritdoc} |
||
154 | * |
||
155 | * @param array An array tree of UploadedFileInterface instances. |
||
156 | * @return self |
||
157 | * @throws \InvalidArgumentException if an invalid structure is provided. |
||
158 | */ |
||
159 | 17 | public function withUploadedFiles(array $uploadedFiles) |
|
163 | |||
164 | /** |
||
165 | * {@inheritdoc} |
||
166 | * |
||
167 | * @return null|array|object The deserialized body parameters, if any. |
||
168 | * These will typically be an array or object. |
||
169 | */ |
||
170 | 1 | public function getParsedBody() |
|
174 | |||
175 | /** |
||
176 | * {@inheritdoc} |
||
177 | * |
||
178 | * @param null|array|object $data The deserialized body data. This will |
||
179 | * typically be in an array or object. |
||
180 | * @return self |
||
181 | * @throws \InvalidArgumentException if an unsupported argument type is |
||
182 | * provided. |
||
183 | */ |
||
184 | 17 | public function withParsedBody($data) |
|
188 | |||
189 | /** |
||
190 | * {@inheritdoc} |
||
191 | * |
||
192 | * @return array Attributes derived from the request. |
||
193 | */ |
||
194 | 1 | public function getAttributes() |
|
198 | |||
199 | /** |
||
200 | * {@inheritdoc} |
||
201 | * |
||
202 | * @see getAttributes() |
||
203 | * @param string $name The attribute name. |
||
204 | * @param mixed $default Default value to return if the attribute does not exist. |
||
205 | * @return mixed |
||
206 | */ |
||
207 | 1 | public function getAttribute($name, $default = null) |
|
215 | |||
216 | /** |
||
217 | * {@inheritdoc} |
||
218 | * |
||
219 | * @see getAttributes() |
||
220 | * @param string $name The attribute name. |
||
221 | * @param mixed $value The value of the attribute. |
||
222 | * @return self |
||
223 | */ |
||
224 | 1 | public function withAttribute($name, $value) |
|
230 | |||
231 | /** |
||
232 | * {@inheritdoc} |
||
233 | * |
||
234 | * @see getAttributes() |
||
235 | * @param string $name The attribute name. |
||
236 | * @return self |
||
237 | */ |
||
238 | 1 | public function withoutAttribute($name) |
|
248 | } |
||
249 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.