@@ -146,24 +146,24 @@ public function __construct(array $config = [])
146146 // Default properties
147147 if (empty ($ config )) {
148148 $ config = [
149- 'url ' => str_replace ('@ ' , '%40 ' , self ::getVar ('REQUEST_URI ' , '/ ' )),
150- 'base ' => str_replace (['\\' , ' ' ], ['/ ' , '%20 ' ], \dirname (self ::getVar ('SCRIPT_NAME ' ))),
151- 'method ' => self ::getMethod (),
152- 'referrer ' => self ::getVar ('HTTP_REFERER ' ),
153- 'ip ' => self ::getVar ('REMOTE_ADDR ' ),
154- 'ajax ' => 'XMLHttpRequest ' === self ::getVar ('HTTP_X_REQUESTED_WITH ' ),
155- 'scheme ' => self ::getScheme (),
149+ 'url ' => str_replace ('@ ' , '%40 ' , self ::getVar ('REQUEST_URI ' , '/ ' )),
150+ 'base ' => str_replace (['\\' , ' ' ], ['/ ' , '%20 ' ], \dirname (self ::getVar ('SCRIPT_NAME ' ))),
151+ 'method ' => self ::getMethod (),
152+ 'referrer ' => self ::getVar ('HTTP_REFERER ' ),
153+ 'ip ' => self ::getVar ('REMOTE_ADDR ' ),
154+ 'ajax ' => 'XMLHttpRequest ' === self ::getVar ('HTTP_X_REQUESTED_WITH ' ),
155+ 'scheme ' => self ::getScheme (),
156156 'user_agent ' => self ::getVar ('HTTP_USER_AGENT ' ),
157- 'type ' => self ::getVar ('CONTENT_TYPE ' ),
158- 'length ' => intval (self ::getVar ('CONTENT_LENGTH ' , 0 )),
159- 'query ' => new Collection ($ _GET ),
160- 'data ' => new Collection ($ _POST ),
161- 'cookies ' => new Collection ($ _COOKIE ),
162- 'files ' => new Collection ($ _FILES ),
163- 'secure ' => 'https ' === self ::getScheme (),
164- 'accept ' => self ::getVar ('HTTP_ACCEPT ' ),
165- 'proxy_ip ' => self ::getProxyIpAddress (),
166- 'host ' => self ::getVar ('HTTP_HOST ' ),
157+ 'type ' => self ::getVar ('CONTENT_TYPE ' ),
158+ 'length ' => intval (self ::getVar ('CONTENT_LENGTH ' , 0 )),
159+ 'query ' => new Collection ($ _GET ),
160+ 'data ' => new Collection ($ _POST ),
161+ 'cookies ' => new Collection ($ _COOKIE ),
162+ 'files ' => new Collection ($ _FILES ),
163+ 'secure ' => 'https ' === self ::getScheme (),
164+ 'accept ' => self ::getVar ('HTTP_ACCEPT ' ),
165+ 'proxy_ip ' => self ::getProxyIpAddress (),
166+ 'host ' => self ::getVar ('HTTP_HOST ' ),
167167 ];
168168 }
169169
@@ -181,7 +181,7 @@ public function init(array $properties = []): self
181181 {
182182 // Set all the defined properties
183183 foreach ($ properties as $ name => $ value ) {
184- $ this ->$ name = $ value ;
184+ $ this ->{ $ name} = $ value ;
185185 }
186186
187187 // Get the requested URL without the base directory
@@ -229,7 +229,7 @@ public function getBody(): string
229229 return $ body ;
230230 }
231231
232- $ method = self ::getMethod ();
232+ $ method = $ this -> method ?? self ::getMethod ();
233233
234234 if ('POST ' === $ method || 'PUT ' === $ method || 'DELETE ' === $ method || 'PATCH ' === $ method ) {
235235 $ body = file_get_contents ($ this ->stream_path );
0 commit comments