From 82678735f3d0500f6217649e55fd0841c9ba9e8d Mon Sep 17 00:00:00 2001 From: Inhere Date: Sun, 27 May 2018 11:21:56 +0800 Subject: [PATCH 1/2] Update HttpFactory.php --- src/HttpFactory.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/HttpFactory.php b/src/HttpFactory.php index 9f43b5a..07ccf50 100644 --- a/src/HttpFactory.php +++ b/src/HttpFactory.php @@ -345,9 +345,9 @@ public static function ensureIsCollection($data): Collection return new Collection($data); } - if (\is_object($data) && \method_exists($data, 'get')) { - return $data; - } + // if (\is_object($data) && \method_exists($data, 'get')) { + // return $data; + // } return new Collection((array)$data); } From babb8af9fcb9039e88f08c4b30ee60f29740186a Mon Sep 17 00:00:00 2001 From: Inhere Date: Sun, 27 May 2018 11:24:00 +0800 Subject: [PATCH 2/2] Create Environment.php --- src/Component/Environment.php | 46 +++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/Component/Environment.php diff --git a/src/Component/Environment.php b/src/Component/Environment.php new file mode 100644 index 0000000..d768799 --- /dev/null +++ b/src/Component/Environment.php @@ -0,0 +1,46 @@ + 'HTTP/1.1', + 'REQUEST_METHOD' => 'GET', + 'SCRIPT_NAME' => '', + 'REQUEST_URI' => '', + 'QUERY_STRING' => '', + 'SERVER_NAME' => 'localhost', + 'SERVER_PORT' => 80, + 'HTTP_HOST' => 'localhost', + 'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', + 'HTTP_ACCEPT_LANGUAGE' => 'en-US,en;q=0.8', + 'HTTP_ACCEPT_CHARSET' => 'utf-8;q=0.7,*;q=0.3', + 'HTTP_USER_AGENT' => 'Slim Framework', + 'REMOTE_ADDR' => '127.0.0.1', + 'REQUEST_TIME' => \time(), + 'REQUEST_TIME_FLOAT' => \microtime(true), + ], $userData); + + return new static($data); + } +}