TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
Router Class Reference
Inheritance diagram for Router:
SingletonInterface

Public Member Functions

 addRoute ($routeIdentifier, $route)
 
 getRoutes ()
 
 match ($pathInfo)
 
 matchRequest (ServerRequestInterface $request)
 

Protected Attributes

 $routes = []
 

Detailed Description

Implementation of a class for adding routes, collecting throughout the Bootstrap to register all sorts of Backend Routes, and to fetch the main Collection in order to resolve a route (see ->match() and ->matchRequest()).

Ideally, the Router is solely instantiated and accessed via the Bootstrap, the RequestHandler and the UriBuilder.

See for more details on route matching() and Bootstrap->initializeBackendRouting().

The architecture is inspired by the Symfony Routing Component.

Definition at line 31 of file Router.php.

Member Function Documentation

addRoute (   $routeIdentifier,
  $route 
)

Adds a new route with the identifiers

Parameters
string$routeIdentifier
Route$route

Definition at line 46 of file Router.php.

getRoutes ( )

Fetch all registered routes, only use in UriBuilder

Returns
Route[]

Definition at line 56 of file Router.php.

References Router\$routes.

match (   $pathInfo)

Tries to match a URL path with a set of routes.

Parameters
string$pathInfoThe path info to be parsed
Returns
Route the first Route object found
Exceptions
ResourceNotFoundExceptionIf the resource could not be found

Definition at line 68 of file Router.php.

Referenced by Router\matchRequest().

matchRequest ( ServerRequestInterface  $request)

Tries to match a URI against the registered routes

Parameters
ServerRequestInterface$request
Returns
Route the first Route object found

Definition at line 87 of file Router.php.

References Router\match().

Member Data Documentation

$routes = []
protected

Definition at line 38 of file Router.php.

Referenced by Router\getRoutes().