PHP Class Neos\Flow\Mvc\Routing\Router

Inheritance: implements Neos\Flow\Mvc\Routing\RouterInterface
Show file Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Property Type Description
$configurationManager Neos\Flow\Configuration\ConfigurationManager
$lastMatchedRoute Route
$lastResolvedRoute Route
$routerCachingService RouterCachingService
$routes array Array of routes to match against
$routesConfiguration array Array containing the configuration for all routes
$routesCreated boolean TRUE if route object have been created, otherwise FALSE
$systemLogger Neos\Flow\Log\SystemLoggerInterface

Public Methods

Method Description
addRoute ( Route $route ) : void Manually adds a route to the beginning of the configured routes
getLastMatchedRoute ( ) : Route Returns the route that has been matched with the last route() call.
getLastResolvedRoute ( ) : Route Returns the route that has been resolved with the last resolve() call.
getRoutes ( ) : array Returns a list of configured routes
resolve ( array $routeValues ) : string Builds the corresponding uri (excluding protocol and host) by iterating through all configured routes and calling their respective resolves() method. If no matching route is found, an empty string is returned.
route ( Request $httpRequest ) : array Iterates through all configured routes and calls matches() on them.
setRoutesConfiguration ( array $routesConfiguration = null ) : void Sets the routes configuration.

Protected Methods

Method Description
createRoutesFromConfiguration ( ) : void Creates \Neos\Flow\Mvc\Routing\Route objects from the injected routes configuration.
initializeRoutesConfiguration ( ) : void Checks if a routes configuration was set and otherwise loads the configuration from the configuration manager.

Method Details

addRoute() public method

Manually adds a route to the beginning of the configured routes
public addRoute ( Route $route ) : void
$route Route
return void

createRoutesFromConfiguration() protected method

Creates \Neos\Flow\Mvc\Routing\Route objects from the injected routes configuration.
protected createRoutesFromConfiguration ( ) : void
return void

getLastMatchedRoute() public method

Returns NULL if no route matched or route() has not been called yet
public getLastMatchedRoute ( ) : Route
return Route

getLastResolvedRoute() public method

Returns NULL if no route was found or resolve() has not been called yet
public getLastResolvedRoute ( ) : Route
return Route

getRoutes() public method

Returns a list of configured routes
public getRoutes ( ) : array
return array

initializeRoutesConfiguration() protected method

Checks if a routes configuration was set and otherwise loads the configuration from the configuration manager.
protected initializeRoutesConfiguration ( ) : void
return void

resolve() public method

Note: calls of this message are cached by RouterCachingAspect
public resolve ( array $routeValues ) : string
$routeValues array Key/value pairs to be resolved. E.g. array('@package' => 'MyPackage', '@controller' => 'MyController');
return string

route() public method

Returns the matchResults of the matching route or NULL if no matching route could be found.
public route ( Request $httpRequest ) : array
$httpRequest Neos\Flow\Http\Request The web request to be analyzed. Will be modified by the router.
return array The results of the matching route or NULL if no route matched

setRoutesConfiguration() public method

Sets the routes configuration.
public setRoutesConfiguration ( array $routesConfiguration = null ) : void
$routesConfiguration array The routes configuration or NULL if it should be fetched from configuration
return void

Property Details

$configurationManager protected property

protected ConfigurationManager,Neos\Flow\Configuration $configurationManager
return Neos\Flow\Configuration\ConfigurationManager

$lastMatchedRoute protected property

protected Route,Neos\Flow\Mvc\Routing $lastMatchedRoute
return Route

$lastResolvedRoute protected property

protected Route,Neos\Flow\Mvc\Routing $lastResolvedRoute
return Route

$routerCachingService protected property

protected RouterCachingService,Neos\Flow\Mvc\Routing $routerCachingService
return RouterCachingService

$routes protected property

Array of routes to match against
protected array $routes
return array

$routesConfiguration protected property

Array containing the configuration for all routes
protected array $routesConfiguration
return array

$routesCreated protected property

TRUE if route object have been created, otherwise FALSE
protected bool $routesCreated
return boolean

$systemLogger protected property

protected SystemLoggerInterface,Neos\Flow\Log $systemLogger
return Neos\Flow\Log\SystemLoggerInterface