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, $handle = null, array $requirements = [], array $options = [], $host = '', $schemes = [], $methods = [], $condition = null)

No description

registerMultiple(array $routes)

No description

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)

No description

Parameters

RouteCollection $routes
RouteActionFactoryInterface $actionFactory

buildGroup()

No description

RouteBuilder get(string $path, string $action)

Since: 8.5.0a2

No description

Parameters

string $path
string $action

Return Value

RouteBuilder

RouteBuilder head(string $path, string $action)

Since: 8.5.0a2

No description

Parameters

string $path
string $action

Return Value

RouteBuilder

RouteBuilder post(string $path, string $action)

Since: 8.5.0a2

No description

Parameters

string $path
string $action

Return Value

RouteBuilder

RouteBuilder put(string $path, string $action)

Since: 8.5.0a2

No description

Parameters

string $path
string $action

Return Value

RouteBuilder

RouteBuilder patch(string $path, string $action)

Since: 8.5.0a2

No description

Parameters

string $path
string $action

Return Value

RouteBuilder

RouteBuilder delete(string $path, string $action)

Since: 8.5.0a2

No description

Parameters

string $path
string $action

Return Value

RouteBuilder

RouteBuilder options(string $path, string $action)

Since: 8.5.0a2

No description

Parameters

string $path
string $action

Return Value

RouteBuilder

RouteBuilder all(string $path, string $action)

Since: 8.5.0a2

No description

Parameters

string $path
string $action

Return Value

RouteBuilder

RouteActionInterface resolveAction(Route $route)

No description

Parameters

Route $route

Return Value

RouteActionInterface

RouteCollection[] getRoutes()

No description

Return Value

RouteCollection[]

RouteActionFactoryInterface getActionFactory()

No description

addRoute(Route $route)

No description

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

RouterInterface::getRouteByPath

MatchedRoute matchRoute(Request $request)

No description

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

RouterInterface::matchRoute

loadRouteList(RouteListInterface $list)

No description

Parameters

RouteListInterface $list

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

No description

Parameters

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

registerMultiple(array $routes)

No description

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}

No description

Parameters

$path
$theme
$wrapper

See also

ThemeRouteCollection::setThemeByRoute

private normalizePath($path)

No description

Parameters

$path

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

No description

Parameters

$path
$action
$methods

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

No description

Parameters

RouteCollection $routes
string $path

Return Value

RouteCollection