ICanBoogie
  • Documentation
  • API Reference
  • Routing v2.3.0
Namespaces
  • ICanBoogie
    • Routing
      • ActionController
      • Controller
      • Dispatcher
      • Route
Classes
  • ActionController
  • Controller
  • Dispatcher
  • FormattedRoute
  • Helpers
  • Pattern
  • Route
  • Routes
Interfaces
  • Exception
  • ToSlug
Exceptions
  • ActionNotDefined
  • ControllerNotDefined
  • PatternNotDefined
  • PatternRequiresValues
  • RouteNotDefined

Class Dispatcher

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\Dispatcher implements ICanBoogie\HTTP\DispatcherInterface
Namespace: ICanBoogie\Routing
Located at Dispatcher.php

Methods summary

public __construct( ICanBoogie\Routing\Routes $routes = null )
public __invoke( ICanBoogie\HTTP\Request $request ) : ICanBoogie\HTTP\Response|null

Parameters

$request

Returns

ICanBoogie\HTTP\Response|null
protected dispatch( ICanBoogie\Routing\Route $route, ICanBoogie\HTTP\Request $request ) : ICanBoogie\HTTP\Response|null

Dispatches the route.

Dispatches the route.

Parameters

$route
$request

Returns

ICanBoogie\HTTP\Response|null
protected respond( ICanBoogie\Routing\Route $route, ICanBoogie\HTTP\Request $request ) : ICanBoogie\HTTP\Response|mixed

Returns a response for the route and request.

Returns a response for the route and request.

If the controller's result is not null but is not in instance of ICanBoogie\HTTP\Response, its result is wrapped in a response instance with the status code 200 and the Content-Type "text/html; charset=utf-8".

Parameters

$route
$request

Returns

ICanBoogie\HTTP\Response|mixed
public rescue( ICanBoogie\Routing\Exception $exception, ICanBoogie\HTTP\Request $request ) : ICanBoogie\HTTP\Response

Fires \ICanBoogie\Routing\Dispatcher\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.

Fires \ICanBoogie\Routing\Dispatcher\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.

Parameters

$exception
The exception to rescue.
$request
The request being dispatched.

Returns

ICanBoogie\HTTP\Response

Throws

Exception
if the exception cannot be rescued.

Properties summary

protected $routes : ICanBoogie\Routing\Routes

Route collection.

Route collection.


		
Routing v2.3.0 – Check on GitHub – API documentation generated by ApiGen