‪TYPO3CMS  11.5
TYPO3\CMS\Backend\Routing\Router Class Reference
Inheritance diagram for TYPO3\CMS\Backend\Routing\Router:
TYPO3\CMS\Core\SingletonInterface

Public Member Functions

 __construct ()
 
 addRoute ($routeIdentifier, $route)
 
Route[] getRoutes ()
 
SymfonyRouteCollection getRouteCollection ()
 
Route match ($pathInfo)
 
Route matchRequest (ServerRequestInterface $request)
 

Protected Attributes

SymfonyRouteCollection $routeCollection
 

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 \TYPO3\CMS\Backend\Http\RequestHandler for more details on route matching() and Bootstrap->initializeBackendRouting().

The architecture is inspired by the Symfony Routing Component.

Definition at line 38 of file Router.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Backend\Routing\Router::__construct ( )

Definition at line 45 of file Router.php.

Member Function Documentation

◆ addRoute()

TYPO3\CMS\Backend\Routing\Router::addRoute (   $routeIdentifier,
  $route 
)

Adds a new route with the identifiers

Parameters
string$routeIdentifier
Route$route

Definition at line 55 of file Router.php.

◆ getRouteCollection()

SymfonyRouteCollection TYPO3\CMS\Backend\Routing\Router::getRouteCollection ( )

only use in Core, this should not be exposed

Returns
‪SymfonyRouteCollection

Definition at line 76 of file Router.php.

References TYPO3\CMS\Backend\Routing\Router\$routeCollection.

Referenced by TYPO3\CMS\Backend\Routing\RouteRedirect\resolve().

◆ getRoutes()

Route [] TYPO3\CMS\Backend\Routing\Router::getRoutes ( )

Fetch all registered routes, only use in UriBuilder

Returns
Route[]

Definition at line 67 of file Router.php.

◆ match()

Route TYPO3\CMS\Backend\Routing\Router::match (   $pathInfo)

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

Parameters
string$pathInfo‪The path info to be parsed
Returns
Route the first Route object found
Exceptions
ResourceNotFoundException‪If the resource could not be found

Definition at line 88 of file Router.php.

Referenced by TYPO3\CMS\Backend\Routing\Router\matchRequest().

◆ matchRequest()

Route TYPO3\CMS\Backend\Routing\Router::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 109 of file Router.php.

References TYPO3\CMS\Backend\Routing\Route\getPath(), and TYPO3\CMS\Backend\Routing\Router\match().

Member Data Documentation

◆ $routeCollection

SymfonyRouteCollection TYPO3\CMS\Backend\Routing\Router::$routeCollection
protected

All routes used in the Backend

Definition at line 43 of file Router.php.

Referenced by TYPO3\CMS\Backend\Routing\Router\getRouteCollection().