This repository has been archived by the owner on Feb 10, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
stevewest
committed
May 10, 2016
1 parent
0cb618a
commit 2054435
Showing
15 changed files
with
159 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,5 +14,4 @@ | |
|
||
class Cli implements RequestInterface | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
/** | ||
* @package Fuel\Foundation | ||
* @version 2.0 | ||
* @author Fuel Development Team | ||
* @license MIT License | ||
* @copyright 2010 - 2016 Fuel Development Team | ||
* @link http://fuelphp.com | ||
*/ | ||
|
||
namespace Fuel\Foundation\Request; | ||
|
||
use Zend\Diactoros\ServerRequest; | ||
|
||
class Http extends ServerRequest implements RequestInterface | ||
{ | ||
public static function forge() | ||
{ | ||
return HttpRequestFactory::fromGlobals(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
/** | ||
* @package Fuel\Foundation | ||
* @version 2.0 | ||
* @author Fuel Development Team | ||
* @license MIT License | ||
* @copyright 2010 - 2016 Fuel Development Team | ||
* @link http://fuelphp.com | ||
*/ | ||
|
||
namespace Fuel\Foundation\Request; | ||
|
||
use UnexpectedValueException; | ||
use Zend\Diactoros\ServerRequestFactory; | ||
|
||
/** | ||
* Temporary request factory until fuel has a http message implementation | ||
* | ||
* @package Fuel\Foundation\Request | ||
*/ | ||
class HttpRequestFactory extends ServerRequestFactory | ||
{ | ||
public static function fromGlobals( | ||
array $server = null, | ||
array $query = null, | ||
array $body = null, | ||
array $cookies = null, | ||
array $files = null | ||
) { | ||
$server = static::normalizeServer($server ?: $_SERVER); | ||
$files = static::normalizeFiles($files ?: $_FILES); | ||
$headers = static::marshalHeaders($server); | ||
|
||
return new Http( | ||
$server, | ||
$files, | ||
static::marshalUriFromServer($server, $headers), | ||
static::get('REQUEST_METHOD', $server, 'GET'), | ||
'php://input', | ||
$headers, | ||
$cookies ?: $_COOKIE, | ||
$query ?: $_GET, | ||
$body ?: $_POST, | ||
static::marshalProtocolVersion($server) | ||
); | ||
|
||
} | ||
|
||
private static function marshalProtocolVersion(array $server) | ||
{ | ||
if (! isset($server['SERVER_PROTOCOL'])) { | ||
return '1.1'; | ||
} | ||
|
||
if (! preg_match('#^(HTTP/)?(?P<version>[1-9]\d*(?:\.\d)?)$#', $server['SERVER_PROTOCOL'], $matches)) { | ||
throw new UnexpectedValueException(sprintf( | ||
'Unrecognized protocol version (%s)', | ||
$server['SERVER_PROTOCOL'] | ||
)); | ||
} | ||
|
||
return $matches['version']; | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
/** | ||
* @package Fuel\Foundation | ||
* @version 2.0 | ||
* @author Fuel Development Team | ||
* @license MIT License | ||
* @copyright 2010 - 2016 Fuel Development Team | ||
* @link http://fuelphp.com | ||
*/ | ||
|
||
namespace Fuel\Foundation\Response; | ||
|
||
use Zend\Diactoros\Response; | ||
|
||
class Http extends Response implements ResponseInterface | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,5 +14,5 @@ | |
|
||
interface ResponseInterface | ||
{ | ||
|
||
public function getStatusCode(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.