Detailed Description

Default Request implementation.

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

Definition at line 28 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
 __construct (Formatter $formatter)
 
 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)
 
 getBooleanValue ($name, $default=false)
 
 getValues ()
 
 clearValue ($name)
 
 clearValues ()
 
 hasValue ($name)
 
 setProperty ($name, $value)
 
 getProperty ($name)
 
 addError (ApplicationError $error)
 
 setErrors (array $errors)
 
 getErrors ()
 
 clearErrors ()
 
 hasErrors ()
 
 __toString ()
 

Protected Member Functions

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

Constructor & Destructor Documentation

__construct ( Formatter  $formatter)

Constructor.

Parameters
$formatter

Definition at line 42 of file DefaultRequest.php.

Member Function Documentation

setResponse ( Response  $response)
See also
Response::setResponse()

Implements Request.

Definition at line 78 of file DefaultRequest.php.

getResponse ( )
See also
Request::getResponse()

Implements Request.

Definition at line 88 of file DefaultRequest.php.

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 107 of file DefaultRequest.php.

getMethod ( )
See also
Request::getMethod()

Implements Request.

Definition at line 191 of file DefaultRequest.php.

setResponseFormat (   $format)
See also
Request::setResponseFormat()

Implements Request.

Definition at line 198 of file DefaultRequest.php.

getResponseFormat ( )
See also
Request::getResponseFormat()

Implements Request.

Definition at line 205 of file DefaultRequest.php.

__toString ( )

Get a string representation of the message.

Returns
The string

Definition at line 216 of file DefaultRequest.php.

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 'numPathParameters', 'parameters', 'methods'

Definition at line 229 of file DefaultRequest.php.

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 312 of file DefaultRequest.php.