$apacheRequestHeaders
$apacheRequestHeaders : callable
Function to use to get apache request headers; present only to simplify mocking.
Factory for making ServerRequest instances.
This subclass adds in CakePHP specific behavior to populate the basePath and webroot attributes. Furthermore the Uri's path is corrected to only contain the 'virtual' path for the request.
fromGlobals(array $server = null, array $query = null, array $body = null, array $cookies = null, array $files = null) : \Zend\Diactoros\ServerRequest
Create a request from the supplied superglobal values.
If any argument is not supplied, the corresponding superglobal value will be used.
The ServerRequest created is then passed to the fromServer() method in order to marshal the request URI and headers.
array | $server | $_SERVER superglobal |
array | $query | $_GET superglobal |
array | $body | $_POST superglobal |
array | $cookies | $_COOKIE superglobal |
array | $files | $_FILES superglobal |
getHeader(string $header, array $headers, mixed $default = null) : string
Search for a header value.
Does a case-insensitive search for a matching header.
If found, it is returned as a string, using comma concatenation.
If not, the $default is returned.
string | $header | |
array | $headers | |
mixed | $default |
None found |
normalizeServer(array $server) : array
Marshal the $_SERVER array
Pre-processes and returns the $_SERVER superglobal.
array | $server |
deprected |
since 1.8.0; use Zend\Diactoros\normalizeServer() instead. |
---|
normalizeFiles(array $files) : array
Normalize uploaded files
Transforms each value into an UploadedFileInterface instance, and ensures that nested arrays are normalized.
array | $files |
for unrecognized values
None found |
marshalHeaders(array $server) : array
Marshal headers from $_SERVER
array | $server |
None found |
marshalUriFromServer(array $server, array $headers) : \Psr\Http\Message\UriInterface
Build a UriInterface object.
Add in some CakePHP specific logic/properties that help preserve backwards compatibility.
array | $server | The server parameters. |
array | $headers | The normalized headers |
a constructed Uri
None found |
marshalHostAndPortFromHeaders(\stdClass $accumulator, array $server, array $headers)
Marshal the host and port from HTTP headers and/or the PHP environment
\stdClass | $accumulator | |
array | $server | |
array | $headers |
None found |
marshalRequestUri(array $server) : string
Detect the base URI for the request
Looks at a variety of criteria in order to attempt to autodetect a base URI, including rewrite URIs, proxy URIs, etc.
array | $server |
None found |
stripQueryString(mixed $path) : string
Strip the query string from a path
mixed | $path |
None found |
createUri(array $server = array()) : \Psr\Http\Message\UriInterface
Create a new Uri instance from the provided server data.
array | $server | Array of server data to build the Uri from. $_SERVER will be added into the $server parameter. |
New instance.
None found |
updatePath(string $base, \Psr\Http\Message\UriInterface $uri) : \Psr\Http\Message\UriInterface
Updates the request URI to remove the base directory.
string | $base | The base path to remove. |
\Psr\Http\Message\UriInterface | $uri | The uri to update. |
The modified Uri instance.
None found |
getBase(\Psr\Http\Message\UriInterface $uri, array $server) : array
Calculate the base directory and webroot directory.
\Psr\Http\Message\UriInterface | $uri | The Uri instance. |
array | $server | The SERVER data to use. |
An array containing the [baseDir, webroot]
None found |