ICanBoogie/Routing v2.4.0
  • Namespace
  • Class

Namespaces

  • ICanBoogie
    • Routing
      • Controller
      • Dispatcher
      • Route

Classes

  • ActionController
  • Controller
  • Dispatcher
  • FormattedRoute
  • Helpers
  • Pattern
  • Route
  • Routes

Interfaces

  • Exception
  • ToSlug

Exceptions

  • ActionNotDefined
  • ControllerNotDefined
  • PatternNotDefined
  • PatternRequiresValues
  • RouteNotDefined

Functions

  • absolutize_url
  • contextualize
  • decontextualize

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 ICanBoogie\HTTP\Response|null
# __invoke( ICanBoogie\HTTP\Request $request )

Parameters

$request

Returns

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

Dispatches the route.

Dispatches the route.

Parameters

$route
$request

Returns

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

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 ICanBoogie\HTTP\Response
# rescue( ICanBoogie\Routing\Exception $exception, ICanBoogie\HTTP\Request $request )

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 ICanBoogie\Routing\Routes $routes

Route collection.

Route collection.

#
ICanBoogie/Routing v2.4.0 API documentation generated by ApiGen