$_routeTable
$_routeTable : array
The routes connected to this collection.
Contains a collection of routes.
Provides an interface for adding/removing routes and parsing/generating URLs with the routes it contains.
$_routes : array<mixed,\Cake\Routing\Route\Route>
The routes connected to this collection.
$_named : array<mixed,\Cake\Routing\Route\Route>
The hash map of named routes that are in this collection.
add(\Cake\Routing\Route\Route $route, array $options = array()) : void
Add a route to the collection.
\Cake\Routing\Route\Route | $route | The route object to add. |
array | $options | Additional options for the route. Primarily for the
|
parse(string $url, string $method = '') : array
Takes the URL string and iterates the routes until one is able to parse the route.
string | $url | URL to parse. |
string | $method | The HTTP method to use. |
When a URL has no matching route.
An array of request parameters parsed from the URL.
parseRequest(\Psr\Http\Message\ServerRequestInterface $request) : array
Takes the ServerRequestInterface, iterates the routes until one is able to parse the route.
\Psr\Http\Message\ServerRequestInterface | $request | The request to parse route data from. |
When a URL has no matching route.
An array of request parameters parsed from the URL.
match(array $url, array $context) : string
Reverse route or match a $url array with the connected routes.
Returns either the URL string generated by the route, or throws an exception on failure.
array | $url | The URL to match. |
array | $context | The request context to use. Contains _base, _port, _host, _scheme and params keys. |
When no route could be matched.
The URL string on match.
routes() : array<mixed,\Cake\Routing\Route\Route>
Get all the connected routes as a flat list.
named() : array<mixed,\Cake\Routing\Route\Route>
Get the connected named routes.
extensions(null|string|array $extensions = null, boolean $merge = true) : array
Get/set the extensions that the route collection could handle.
null|string|array | $extensions | Either the list of extensions to set, or null to get. |
boolean | $merge | Whether to merge with or override existing extensions.
Defaults to |
The valid extensions.
getExtensions() : array
Get the extensions that can be handled.
The valid extensions.
None found |
setExtensions(array $extensions, boolean $merge = true) : $this
Set the extensions that the route collection can handle.
array | $extensions | The list of extensions to set. |
boolean | $merge | Whether to merge with or override existing extensions.
Defaults to |
None found |
registerMiddleware(string $name, callable|string $middleware) : $this
Register a middleware with the RouteCollection.
Once middleware has been registered, it can be applied to the current routing scope or any child scopes that share the same RouteCollection.
string | $name | The name of the middleware. Used when applying middleware to a scope. |
callable|string | $middleware | The middleware callable or class name to register. |
None found |
middlewareGroup(string $name, array $middlewareNames) : $this
Add middleware to a middleware group
string | $name | Name of the middleware group |
array | $middlewareNames | Names of the middleware |
None found |
hasMiddlewareGroup(string $name) : boolean
Check if the named middleware group has been created.
string | $name | The name of the middleware group to check. |
None found |
hasMiddleware(string $name) : boolean
Check if the named middleware has been registered.
string | $name | The name of the middleware to check. |
None found |
middlewareExists(string $name) : boolean
Check if the named middleware or middleware group has been registered.
string | $name | The name of the middleware to check. |
None found |
applyMiddleware(string $path, array<mixed,string> $middleware) : $this
Apply a registered middleware(s) for the provided path
string | $path | The URL path to register middleware for. |
array<mixed,string> | $middleware | The middleware names to add for the path. |
None found |
getMiddleware(array $names) : array
Get an array of middleware given a list of names
array | $names | The names of the middleware or groups to fetch |
when a requested middleware does not exist.
An array of middleware. If any of the passed names are groups, the groups middleware will be flattened into the returned list.
None found |
_getNames(array $url) : array
Get the set of names from the $url. Accepts both older style array urls, and newer style urls containing '_name'
array | $url | The url to match. |
The set of names of the url
None found |