Skip to content

Commit

Permalink
Merge branch '1ma-rm-deprecated-factory'
Browse files Browse the repository at this point in the history
Closes #21
  • Loading branch information
akrabat committed May 7, 2017
2 parents 8037cbe + f352654 commit 7407c9e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 25 deletions.
22 changes: 0 additions & 22 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions tests/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ public function testWithMethodNull()
$this->assertAttributeEquals(null, 'method', $request);
}

/**
* @covers Slim\Http\Request::createFromGlobals
*/
public function testCreateFromEnvironmentWithMultipart()
{
$_POST['foo'] = 'bar';
Expand Down

0 comments on commit 7407c9e

Please sign in to comment.