Fix Request for PHP 5.3.0 compatibility

This commit is contained in:
PJ Dietz 2014-07-28 10:08:27 -04:00
parent a242fc9e5f
commit 46f11b2b9b
3 changed files with 8 additions and 3 deletions

5
.idea/php.xml Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PhpProjectSharedConfiguration" php_language_level="5.3.0" />
</project>

View File

@ -92,7 +92,7 @@ class Request extends Message implements RequestInterface
public static function getRequestHeaders() public static function getRequestHeaders()
{ {
// http://www.php.net/manual/en/function.getallheaders.php#84262 // http://www.php.net/manual/en/function.getallheaders.php#84262
$headers = []; $headers = array();
foreach ($_SERVER as $name => $value) { foreach ($_SERVER as $name => $value) {
if (substr($name, 0, 5) === "HTTP_") { if (substr($name, 0, 5) === "HTTP_") {
$headers[str_replace(" ", "-", ucwords(strtolower(str_replace("_", " ", substr($name, 5)))))] = $value; $headers[str_replace(" ", "-", ucwords(strtolower(str_replace("_", " ", substr($name, 5)))))] = $value;
@ -343,7 +343,7 @@ class Request extends Message implements RequestInterface
/** /**
* Set the body by supplying an associative array of form fields. * Set the body by supplying an associative array of form fields.
* *
* In additon, add a "Content-type: application/x-www-form-urlencoded" header * In addition, add a "Content-type: application/x-www-form-urlencoded" header
* *
* @param array $fields * @param array $fields
*/ */

View File

@ -174,7 +174,7 @@ class RouteBuilder
} }
/** /**
* Create and return an approrate route given an object describing a route. * Create and return an appropriate route given an object describing a route.
* *
* $item must contain a "handler" property providing the classname for the * $item must contain a "handler" property providing the classname for the
* HandlerInterface to call getResponse() on if the route matches. "handler" * HandlerInterface to call getResponse() on if the route matches. "handler"