diff --git a/src/Request.php b/src/Request.php index 9b3d944..57ff7ee 100644 --- a/src/Request.php +++ b/src/Request.php @@ -172,28 +172,6 @@ public function __construct($method, UriInterface $uri, HeadersInterface $header }); } - public static function createFromGlobals(array $globals) - { - $env = new Collection($globals); - $method = $env->get('REQUEST_METHOD'); - $uri = Uri::createFromGlobals($globals); - $headers = Headers::createFromGlobals($globals); - $cookies = Cookies::parseHeader($headers->get('Cookie', [])); - $serverParams = $globals; - $body = new RequestBody(); - $uploadedFiles = UploadedFile::createFromGlobals($globals); - $request = new static($method, $uri, $headers, $cookies, $serverParams, $body, $uploadedFiles); - - if ($method === 'POST' && - in_array($request->getMediaType(), ['application/x-www-form-urlencoded', 'multipart/form-data']) - ) { - // parsed body must be $_POST - $request = $request->withParsedBody($_POST); - } - - return $request; - } - /** * This method is applied to the cloned object * after PHP performs an initial shallow-copy. This diff --git a/tests/RequestTest.php b/tests/RequestTest.php index fd9950b..69c0148 100644 --- a/tests/RequestTest.php +++ b/tests/RequestTest.php @@ -95,9 +95,6 @@ public function testWithMethodNull() $this->assertAttributeEquals(null, 'method', $request); } - /** - * @covers Slim\Http\Request::createFromGlobals - */ public function testCreateFromEnvironmentWithMultipart() { $_POST['foo'] = 'bar';