Class RequestDispatcher
Dispatches HTTP requests.
The following events are fired during the dispatching of requests:
ICanBoogie\HTTP\RequestDispatcher::dispatch:before
of classICanBoogie\HTTP\RequestDispatcher\BeforeDispatchEvent
.ICanBoogie\HTTP\RequestDispatcher::dispatch
of classICanBoogie\HTTP\RequestDispatcher\DispatchEvent
.ICanBoogie\HTTP\RequestDispatcher::rescue
of classICanBoogie\Exception\RescueEvent
.
- ICanBoogie\HTTP\RequestDispatcher implements ArrayAccess, IteratorAggregate, ICanBoogie\HTTP\Dispatcher
Methods summary
public
__construct( array $dispatchers
= [] )
Dispatchers can be defined as callable or class name. If a dispatcher definition is not a callable it is used as class name to instantiate a dispatcher.
public
__invoke( ICanBoogie\HTTP\Request
$request
)
: ICanBoogie\HTTP\Response
Dispatch a request and return a ICanBoogie\HTTP\Response
.
protected
dispatch( ICanBoogie\HTTP\Request
$request
)
: ICanBoogie\HTTP\Response
Dispatch a request using defined dispatchers.
protected
dispatch_with_dispatcher( ICanBoogie\HTTP\Dispatcher
$dispatcher
, ICanBoogie\HTTP\Request
$request
)
: ICanBoogie\HTTP\Response
Dispatch the request using a dispatcher.
public
rescue( ICanBoogie\HTTP\Exception
$exception
, ICanBoogie\HTTP\Request
$request
)
: ICanBoogie\HTTP\Response
Try to get a ICanBoogie\HTTP\Response
object from an exception.
protected
alter_response_with_exception( ICanBoogie\HTTP\Response
$response
, ICanBoogie\HTTP\Exception
$exception
)
Alter a response with an exception.