Class RouteDispatcher
Dispatch requests among the defined routes.
If a route matching the request is found, the $route
and $decontextualized_path
properties are added to the ICanBoogie\HTTP\Request instance. $route
holds the ICanBoogie\Routing\Route
instance,
$decontextualized_path
holds the decontextualized path. The path is decontextualized using
the decontextualize() function.
- ICanBoogie\Routing\RouteDispatcher implements ICanBoogie\HTTP\Dispatcher uses ICanBoogie\Accessor\AccessorTrait (not available)
Methods summary
protected
resolve_route( ICanBoogie\HTTP\Request $request
, string $normalized_path
, array & $captured
)
: false|ICanBoogie\Routing\Route
|null
Resolves route from request.
protected
alter_params( ICanBoogie\Routing\Route
$route
, ICanBoogie\HTTP\Request $request
, array $captured
)
Alters request parameters.
protected
alter_context( ICanBoogie\HTTP\Request\Context $context
, ICanBoogie\Routing\Route
$route
, callable $controller
)
Alters request context with route and controller.
protected
dispatch( ICanBoogie\Routing\Route
$route
, ICanBoogie\HTTP\Request $request
)
: ICanBoogie\HTTP\Response|null
Dispatches the route.
protected
respond( ICanBoogie\Routing\Route
$route
, ICanBoogie\HTTP\Request $request
)
: ICanBoogie\HTTP\Response|mixed
Returns a response for the route and request.
public
rescue( ICanBoogie\Routing\Exception
$exception
, ICanBoogie\HTTP\Request $request
)
: ICanBoogie\HTTP\Response
Fires \ICanBoogie\Routing\RouteDispatcher\RescueEvent and returns the response provided by third parties. If no response was provided, the exception (or the exception provided by third parties) is re-thrown.