|
|
@@ -81,18 +81,34 @@ abstract class ServerRequestFactory implements ServerRequestFactoryInterface
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * {@inheritDoc}
|
|
|
+ * Create a new server request.
|
|
|
+ *
|
|
|
+ * Note that server-params are taken precisely as given - no parsing/processing
|
|
|
+ * of the given values is performed, and, in particular, no attempt is made to
|
|
|
+ * determine the HTTP method or URI, which must be provided explicitly.
|
|
|
+ *
|
|
|
+ * @param string $method The HTTP method associated with the request.
|
|
|
+ * @param \Psr\Http\Message\UriInterface|string $uri The URI associated with the request. If
|
|
|
+ * the value is a string, the factory MUST create a UriInterface
|
|
|
+ * instance based on it.
|
|
|
+ * @param array $serverParams Array of SAPI parameters with which to seed
|
|
|
+ * the generated request instance.
|
|
|
+ *
|
|
|
+ * @return \Psr\Http\Message\ServerRequestInterface
|
|
|
*/
|
|
|
public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface
|
|
|
{
|
|
|
- $uploadedFiles = [];
|
|
|
-
|
|
|
- return new ServerRequest(
|
|
|
- $serverParams,
|
|
|
- $uploadedFiles,
|
|
|
- $uri,
|
|
|
- $method
|
|
|
- );
|
|
|
+ $options = ['environment' => $serverParams];
|
|
|
+
|
|
|
+ if ($uri instanceof UriInterface) {
|
|
|
+ $options['uri'] = $uri;
|
|
|
+ } else {
|
|
|
+ $options['url'] = $uri;
|
|
|
+ }
|
|
|
+
|
|
|
+ $request = new ServerRequest($options);
|
|
|
+
|
|
|
+ return $request->withMethod($method);
|
|
|
}
|
|
|
|
|
|
/**
|