|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Class ServerRequestFactory |
|
4
|
|
|
* |
|
5
|
|
|
* @filesource ServerRequestFactory.php |
|
6
|
|
|
* @created 27.08.2018 |
|
7
|
|
|
* @package chillerlan\HTTP\Psr17 |
|
8
|
|
|
* @author smiley <[email protected]> |
|
9
|
|
|
* @copyright 2018 smiley |
|
10
|
|
|
* @license MIT |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
namespace chillerlan\HTTP\Psr17; |
|
14
|
|
|
|
|
15
|
|
|
use chillerlan\HTTP\Psr7\ServerRequest; |
|
16
|
|
|
use Psr\Http\Message\{ServerRequestFactoryInterface, ServerRequestInterface}; |
|
17
|
|
|
|
|
18
|
|
|
final class ServerRequestFactory extends RequestFactory implements ServerRequestFactoryInterface{ |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Create a new server request. |
|
22
|
|
|
* |
|
23
|
|
|
* Note that server-params are taken precisely as given - no parsing/processing |
|
24
|
|
|
* of the given values is performed, and, in particular, no attempt is made to |
|
25
|
|
|
* determine the HTTP method or URI, which must be provided explicitly. |
|
26
|
|
|
* |
|
27
|
|
|
* @param string $method The HTTP method associated with the request. |
|
28
|
|
|
* @param \Psr\Http\Message\UriInterface|string $uri The URI associated with the request. If |
|
29
|
|
|
* the value is a string, the factory MUST |
|
30
|
|
|
* create a UriInterface instance based on it. |
|
31
|
|
|
* @param array $serverParams Array of SAPI parameters with which to seed |
|
32
|
|
|
* the generated request instance. |
|
33
|
|
|
* |
|
34
|
|
|
* @return \Psr\Http\Message\ServerRequestInterface|\chillerlan\HTTP\Psr7\ServerRequest |
|
35
|
|
|
*/ |
|
36
|
|
|
public function createServerRequest(string $method, $uri, array $serverParams = []):ServerRequestInterface{ |
|
37
|
|
|
return new ServerRequest($method, $uri, null, null, null, $serverParams); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
} |
|
41
|
|
|
|