class Router implements RouterInterface (View source)

Properties

protected RouteActionFactoryInterface $actionFactory
protected RouteCollection $routes

Methods

__construct(RouteCollection $routes, RouteActionFactoryInterface $actionFactory)

No description

buildGroup()

No description

get(string $path, string $action)

No description

head(string $path, string $action)

No description

post(string $path, string $action)

No description

put(string $path, string $action)

No description

patch(string $path, string $action)

No description

delete(string $path, string $action)

No description

options(string $path, string $action)

No description

all(string $path, string $action)

No description

resolveAction(Route $route)

No description

RouteCollection[]
getRoutes()

No description

addRoute(Route $route)

No description

getRouteByPath(string $path, RequestContext $context, array $routeAttributes = [])

Get a route given its path.

matchRoute(Request $request)

No description

loadRouteList(RouteListInterface $list)

No description

register($path, $callback, null $handle = null, array $requirements = [], array $options = [], string $host = '', array $schemes = [], array $methods = [], null $condition = null) deprecated

No description

registerMultiple(array $routes) deprecated

Registers routes from a config array. This is deprecated. Use the $router object directly in an included file.

string
route($data) deprecated

Returns a route string based on data. DO NOT USE THIS.

setThemeByRoute($path, $theme = null, $wrapper = FILENAME_THEMES_VIEW) deprecated

No description

normalizePath($path)

No description

createRouteBuilder($path, $action, $methods)

No description

RouteCollection
filterRouteCollectionForPath(RouteCollection $routes, string $path)

No description

Details

__construct(RouteCollection $routes, RouteActionFactoryInterface $actionFactory)

Parameters

RouteCollection $routes
RouteActionFactoryInterface $actionFactory

buildGroup()

RouteBuilder get(string $path, string $action)

Parameters

string $path
string $action

Return Value

RouteBuilder

RouteBuilder head(string $path, string $action)

Parameters

string $path
string $action

Return Value

RouteBuilder

RouteBuilder post(string $path, string $action)

Parameters

string $path
string $action

Return Value

RouteBuilder

RouteBuilder put(string $path, string $action)

Parameters

string $path
string $action

Return Value

RouteBuilder

RouteBuilder patch(string $path, string $action)

Parameters

string $path
string $action

Return Value

RouteBuilder

RouteBuilder delete(string $path, string $action)

Parameters

string $path
string $action

Return Value

RouteBuilder

RouteBuilder options(string $path, string $action)

Parameters

string $path
string $action

Return Value

RouteBuilder

RouteBuilder all(string $path, string $action)

Parameters

string $path
string $action

Return Value

RouteBuilder

RouteActionInterface resolveAction(Route $route)

Parameters

Route $route

Return Value

RouteActionInterface

RouteCollection[] getRoutes()

Return Value

RouteCollection[]

addRoute(Route $route)

Parameters

Route $route

Route getRouteByPath(string $path, RequestContext $context, array $routeAttributes = [])

Get a route given its path.

Parameters

string $path the path to be looked for
RequestContext $context the context to be used to match the routes
array $routeAttributes [output] if specified, this argument will contain the route attributes

Return Value

Route

Exceptions

NoConfigurationException If no routing configuration could be found
ResourceNotFoundException If the resource could not be found
MethodNotAllowedException If the resource was found but the request method is not allowed

See also

\Concrete\Core\Routing\RouterInterface::getRouteByPath()

MatchedRoute matchRoute(Request $request)

Parameters

Request $request

Return Value

MatchedRoute

Exceptions

NoConfigurationException If no routing configuration could be found
ResourceNotFoundException If the resource could not be found
MethodNotAllowedException If the resource was found but the request method is not allowed

See also

\Concrete\Core\Routing\RouterInterface::matchRoute()

loadRouteList(RouteListInterface $list)

Parameters

RouteListInterface $list

Route register($path, $callback, null $handle = null, array $requirements = [], array $options = [], string $host = '', array $schemes = [], array $methods = [], null $condition = null) deprecated

deprecated . Use the verb methods instead.

Parameters

$path
$callback
null $handle
array $requirements
array $options
string $host
array $schemes
array $methods
null $condition

Return Value

Route

registerMultiple(array $routes) deprecated

deprecated .

Registers routes from a config array. This is deprecated. Use the $router object directly in an included file.

Parameters

array $routes

string route($data) deprecated

deprecated

Returns a route string based on data. DO NOT USE THIS.

Parameters

$data

Return Value

string

setThemeByRoute($path, $theme = null, $wrapper = FILENAME_THEMES_VIEW) deprecated

deprecated Use $app->make(\Concrete\Core\Page\Theme\ThemeRouteCollection::class)->setThemeByRoute() with the same arguments {@inheritdoc}

Parameters

$path
$theme
$wrapper

See also

\Concrete\Core\Page\Theme\ThemeRouteCollection::setThemeByRoute()

private normalizePath($path)

Parameters

$path

private createRouteBuilder($path, $action, $methods)

Parameters

$path
$action
$methods

private RouteCollection filterRouteCollectionForPath(RouteCollection $routes, string $path)

Parameters

RouteCollection $routes
string $path

Return Value

RouteCollection