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

Public Member Functions

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

Protected Attributes

Route[] $routes = array( )
 

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 33 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 47 of file Router.php.

◆ getRoutes()

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

Fetch all registered routes, only use in UriBuilder

Returns
Route[]

Definition at line 57 of file Router.php.

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

◆ 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 69 of file Router.php.

References TYPO3\CMS\Backend\Routing\Route\setOption().

Referenced by TYPO3\CMS\Backend\Routing\UriBuilder\buildUriFromRoutePath(), and 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 88 of file Router.php.

References TYPO3\CMS\Backend\Routing\Router\match().

Member Data Documentation

◆ $routes

Route [] TYPO3\CMS\Backend\Routing\Router::$routes = array( )
protected

All routes used in the Backend

Definition at line 39 of file Router.php.

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