Class ServerRequestFactory
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.
- Zend\Diactoros\ServerRequestFactory
-
Cake\Http\ServerRequestFactory
Method Summary
-
createUri() public static
Create a new Uri instance from the provided server data. -
fromGlobals() public static
-
getBase() protected static
Calculate the base directory and webroot directory. -
marshalUriFromServer() public static
Build a UriInterface object. -
updatePath() protected static
Updates the request URI to remove the base directory.
Method Detail
createUri() public static ¶
createUri( array $server [] )
Create a new Uri instance from the provided server data.
Parameters
- array $server optional []
Array of server data to build the Uri from. $_SERVER will be added into the $server parameter.
Returns
New instance.
fromGlobals() public static ¶
fromGlobals( array $server null , array $query null , array $body null , array $cookies null , array $files null )
getBase() protected static ¶
getBase( Psr\Http\Message\UriInterface $uri , array $server )
Calculate the base directory and webroot directory.
Parameters
- Psr\Http\Message\UriInterface $uri
- The Uri instance.
- array $server
- The SERVER data to use.
Returns
An array containing the [baseDir, webroot]
marshalUriFromServer() public static ¶
marshalUriFromServer( array $server , array $headers )
Build a UriInterface object.
Add in some CakePHP specific logic/properties that help preserve backwards compatibility.
Parameters
- array $server
- The server parameters.
- array $headers
- The normalized headers
Returns
a constructed Uri
updatePath() protected static ¶
updatePath( string $base , Psr\Http\Message\UriInterface $uri )
Updates the request URI to remove the base directory.
Parameters
- string $base
- The base path to remove.
- Psr\Http\Message\UriInterface $uri
- The uri to update.
Returns
The modified Uri instance.