Detailed Description

Default Request implementation.

Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 27 of file DefaultRequest.php.

+ Inheritance diagram for DefaultRequest:

Public Member Functions

 __construct (Formatter $formatter)
 
 setResponse (Response $response)
 
 getResponse ()
 
 initialize ($controller=null, $context=null, $action=null)
 
 getMethod ()
 
 setResponseFormat ($format)
 
 getResponseFormat ()
 
 __toString ()
 
- Public Member Functions inherited from AbstractControllerMessage
 setSender ($sender)
 
 getSender ()
 
 setContext ($context)
 
 getContext ()
 
 setAction ($action)
 
 getAction ()
 
 setFormat ($format)
 
 getFormat ()
 
 setHeader ($name, $value)
 
 setHeaders (array $headers)
 
 getHeader ($name, $default=null)
 
 getHeaders ()
 
 clearHeader ($name)
 
 clearHeaders ()
 
 hasHeader ($name)
 
 setValue ($name, $value)
 
 setValues (array $values)
 
 getValue ($name, $default=null, $validateDesc=null, $suppressException=false)
 
 getBooleanValue ($name, $default=false)
 
 getValues ()
 
 clearValue ($name)
 
 clearValues ()
 
 hasValue ($name)
 
 setProperty ($name, $value)
 
 getProperty ($name)
 
 addError (ApplicationError $error)
 
 setErrors (array $errors)
 
 getErrors ()
 
 clearErrors ()
 
 hasErrors ()
 

Protected Member Functions

 getMatchingRoutes ($requestPath)
 
 isMatch ($routeData)
 
 getBestRoute ($routes)
 
- Protected Member Functions inherited from AbstractControllerMessage
 getFormatter ()
 

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:

GET/ = action=cms
GET,POST,PUT,DELETE/rest/{language}/{className} = action=restAction&collection=1
GET,POST,PUT,DELETE/rest/{language}/{className}/{id|[0-9]+} = action=restAction&collection=0

Implements Request.

Definition at line 106 of file DefaultRequest.php.

◆ getMethod()

getMethod ( )
See also
Request::getMethod()

Implements Request.

Definition at line 190 of file DefaultRequest.php.

◆ 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()

getMatchingRoutes (   $requestPath)
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()

isMatch (   $routeData)
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
$routeDataArray as single match returned from DefaultRequest::getMatchingRoutes()
Returns
Boolean

Definition at line 324 of file DefaultRequest.php.

◆ getBestRoute()

getBestRoute (   $routes)
protected

Get the best matching route from the given list of routes.

Parameters
$routesArray of route definitions as returned by getMatchingRoutes()
Returns
Array with keys 'numPathParameters', 'parameters', 'methods'

Definition at line 333 of file DefaultRequest.php.