Class MOXMAN_Http_Context

InheritanceMOXMAN_Http_Context

This class works as a factory for Request and response instances.

Public Methods

Hide inherited methods

MethodDescriptionDefined 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

__construct() public method

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
getCurrent() public static method

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.

getRequest() public method

Returns the HTTP request instance.

public MOXMAN_Http_Request getRequest ( )
return MOXMAN_Http_Request

HTTP request instance for the HTTP context.

getResponse() public method

Returns the HTTP response instance.

public MOXMAN_Http_Response getResponse ( )
return MOXMAN_Http_Response

HTTP response instance for the HTTP context.

getSession() public method

Returns the HTTP session instance.

public MOXMAN_Http_Session getSession ( )
return MOXMAN_Http_Session

HTTP response instance for the HTTP context.

setCurrent() public static method

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.