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); + } +} 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); }