Detailed Description
Default Request implementation.
Definition at line 27 of file DefaultRequest.php.
Public Member Functions | |
__construct (Formatter $formatter) | |
setResponse (Response $response) | |
getResponse () | |
initialize ($controller=null, $context=null, $action=null) | |
getMethod () | |
setResponseFormat ($format) | |
getResponseFormat () | |
__toString () | |
Protected Member Functions | |
getMatchingRoutes ($requestPath) | |
isMatch ($routeData) | |
getBestRoute ($routes) | |
Constructor & Destructor Documentation
◆ __construct()
__construct | ( | Formatter | $formatter | ) |
Constructor.
- Parameters
-
$formatter
Reimplemented from AbstractControllerMessage.
Definition at line 41 of file DefaultRequest.php.
Member Function Documentation
◆ setResponse()
setResponse | ( | Response | $response | ) |
- See also
- Response::setResponse()
Implements Request.
Definition at line 77 of file DefaultRequest.php.
◆ getResponse()
getResponse | ( | ) |
- See also
- Request::getResponse()
Implements Request.
Definition at line 87 of file DefaultRequest.php.
◆ initialize()
initialize | ( | $controller = null , |
|
$context = null , |
|||
$action = null |
|||
) |
- See also
- Request::initialize()
The method tries to match the current request path against the routes defined in the configuration section 'routes' and constructs the request based on these parameters. It then adds all data contained in $_GET, $_POST, $_FILES and php://input (raw data from the request body).
Examples for route definitions are:
Implements Request.
Definition at line 106 of file DefaultRequest.php.
◆ getMethod()
getMethod | ( | ) |
◆ setResponseFormat()
setResponseFormat | ( | $format | ) |
- See also
- Request::setResponseFormat()
Implements Request.
Definition at line 197 of file DefaultRequest.php.
◆ getResponseFormat()
getResponseFormat | ( | ) |
- See also
- Request::getResponseFormat()
Implements Request.
Definition at line 204 of file DefaultRequest.php.
◆ __toString()
__toString | ( | ) |
Get a string representation of the message.
- Returns
- The string
Reimplemented from AbstractControllerMessage.
Definition at line 215 of file DefaultRequest.php.
◆ getMatchingRoutes()
|
protected |
Get all routes from the Routes configuration section that match the given request path.
- Parameters
-
$requestPath
- Returns
- Array of arrays with keys 'route', 'numPathParameters', 'numPathPatterns', 'parameters', 'methods'
Definition at line 228 of file DefaultRequest.php.
◆ isMatch()
|
protected |
Check if the given route data match a route definition.
- Note
- Subclasses will override this to implement custom matching. The default implementation returns true.
- Parameters
-
$routeData Array as single match returned from DefaultRequest::getMatchingRoutes()
- Returns
- Boolean
Definition at line 324 of file DefaultRequest.php.
◆ getBestRoute()
|
protected |
Get the best matching route from the given list of routes.
- Parameters
-
$routes Array of route definitions as returned by getMatchingRoutes()
- Returns
- Array with keys 'numPathParameters', 'parameters', 'methods'
Definition at line 333 of file DefaultRequest.php.