1 | <?php |
||
18 | final class ServerRequestFactory implements ServerRequestFactoryInterface |
||
19 | { |
||
20 | 23 | public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface |
|
24 | |||
25 | 15 | public function createServerRequestFromArray(array $server): ServerRequestInterface |
|
29 | |||
30 | /** |
||
31 | * Create a new server request from a set of arrays. |
||
32 | * |
||
33 | * @param array $server Typically $_SERVER or similar structure. |
||
34 | * @param array $headers Typically the output of getallheaders() or similar structure. |
||
35 | * @param array $cookie Typically $_COOKIE or similar structure. |
||
36 | * @param array $get Typically $_GET or similar structure. |
||
37 | * @param array $post Typically $_POST or similar structure. |
||
38 | * @param array $files Typically $_FILES or similar structure. |
||
39 | * |
||
40 | * @throws InvalidArgumentException If no valid method or URI can be determined. |
||
41 | */ |
||
42 | public function createServerRequestFromArrays(array $server, array $headers, array $cookie, array $get, array $post, array $files): ServerRequestInterface |
||
57 | |||
58 | /** |
||
59 | * Create a new server request from the current environment variables. |
||
60 | * Defaults to a GET request to minimise the risk of an InvalidArgumentException. |
||
61 | * Includes the current request headers as supplied by the server through `getallheaders()`. |
||
62 | * |
||
63 | * @throws InvalidArgumentException If no valid method or URI can be determined. |
||
64 | */ |
||
65 | public function createServerRequestFromGlobals(): ServerRequestInterface |
||
75 | |||
76 | 15 | private function getMethodFromEnv(array $environment): string |
|
84 | |||
85 | 15 | private function getUriFromEnvWithHTTP(array $environment): \Psr\Http\Message\UriInterface |
|
94 | |||
95 | /** |
||
96 | * Return an UploadedFile instance array. |
||
97 | * |
||
98 | * @param array $files A array which respect $_FILES structure |
||
99 | * |
||
100 | * @throws InvalidArgumentException for unrecognized values |
||
101 | */ |
||
102 | private static function normalizeFiles(array $files): array |
||
122 | |||
123 | /** |
||
124 | * Create and return an UploadedFile instance from a $_FILES specification. |
||
125 | * |
||
126 | * If the specification represents an array of values, this method will |
||
127 | * delegate to normalizeNestedFileSpec() and return that return value. |
||
128 | * |
||
129 | * @param array $value $_FILES struct |
||
130 | * |
||
131 | * @return array|UploadedFileInterface |
||
132 | */ |
||
133 | private static function createUploadedFileFromSpec(array $value) |
||
147 | |||
148 | /** |
||
149 | * Normalize an array of file specifications. |
||
150 | * |
||
151 | * Loops through all nested files and returns a normalized array of |
||
152 | * UploadedFileInterface instances. |
||
153 | * |
||
154 | * @param array $files |
||
155 | * |
||
156 | * @return UploadedFileInterface[] |
||
157 | */ |
||
158 | private static function normalizeNestedFileSpec(array $files = []): array |
||
175 | } |
||
176 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.