Class MOXMAN_Http_Context
Inheritance | MOXMAN_Http_Context |
---|
This class works as a factory for Request and response instances.
Public Methods
Method | Description | Defined By |
---|---|---|
__construct() | Constructs a new http context instance with the specified request and response instances to use. | MOXMAN_Http_Context |
getCurrent() | Returns the current HTTP context. It will return the default context or a custom instance if you use the setCurrent method, | MOXMAN_Http_Context |
getRequest() | Returns the HTTP request instance. | MOXMAN_Http_Context |
getResponse() | Returns the HTTP response instance. | MOXMAN_Http_Context |
getSession() | Returns the HTTP session instance. | MOXMAN_Http_Context |
setCurrent() | Sets the current http context instance. This makes it easier to unit test the application since you can replace the HTTP Request and HTTP Response with custom mockup logic. | MOXMAN_Http_Context |
Method Details
Constructs a new http context instance with the specified request and response instances to use.
public void __construct ( MOXMAN_Http_Request $request, MOXMAN_Http_Response $response, MOXMAN_Http_Session $session ) | ||
$request | MOXMAN_Http_Request | HTTP request instance to use for the context. |
$response | MOXMAN_Http_Response | HTTP response instance to use for the context. |
$session |
Returns the current HTTP context. It will return the default context or a custom instance if you use the setCurrent method,
public static MOXMAN_Http_Context getCurrent ( ) | ||
return | MOXMAN_Http_Context | HTTP context instance to use. |
---|
Returns the HTTP request instance.
public MOXMAN_Http_Request getRequest ( ) | ||
return | MOXMAN_Http_Request | HTTP request instance for the HTTP context. |
---|
Returns the HTTP response instance.
public MOXMAN_Http_Response getResponse ( ) | ||
return | MOXMAN_Http_Response | HTTP response instance for the HTTP context. |
---|
Returns the HTTP session instance.
public MOXMAN_Http_Session getSession ( ) | ||
return | MOXMAN_Http_Session | HTTP response instance for the HTTP context. |
---|
Sets the current http context instance. This makes it easier to unit test the application since you can replace the HTTP Request and HTTP Response with custom mockup logic.
public static void setCurrent ( MOXMAN_Http_Context $context ) | ||
$context | MOXMAN_Http_Context | HTTP context instance to use instead of the default. |