RouteCollection
class RouteCollection extends AbstractRouteCollection
Properties
| protected Route>> | $routes | An array of the routes keyed by method. |
|
| protected Route> | $allRoutes | A flattened array of all of the routes. |
|
| protected Route> | $nameList | A look-up table of routes by their names. |
|
| protected Route> | $actionList | A look-up table of routes by controller action. |
Methods
Determine if a route in the array matches the request.
Get a route (if necessary) that responds when other available methods are present.
Throw a method not allowed HTTP exception.
Return the CompiledUrlMatcherDumper instance for the route collection.
Convert the collection to a Symfony RouteCollection instance.
Add a route to the SymfonyRouteCollection instance.
Get the route instances that should be pre-warmed.
Determine if the given controller is in the action lookup table.
Determine if the given name is in the name lookup table.
Refresh the name look-up table.
Refresh the action look-up table.
Get routes from the collection by method.
Determine if the route collection contains a given named route.
Get a route instance by its controller action.
Get all of the routes in the collection.
Get all of the routes keyed by their HTTP verb / method.
Get all of the routes keyed by their name.
Convert the collection to a CompiledRouteCollection instance.
Details
in
AbstractRouteCollection at line 27
protected Route
handleMatchedRoute(Request $request, Route|null $route)
Handle the matched route.
in
AbstractRouteCollection at line 53
protected array
checkForAlternateVerbs(Request $request)
Determine if any routes match on another HTTP verb.
in
AbstractRouteCollection at line 73
protected Route|null
matchAgainstRoutes(array $routes, Request $request, bool $includingMethod = true)
Determine if a route in the array matches the request.
in
AbstractRouteCollection at line 99
protected Route
getRouteForMethods(Request $request, array $methods)
Get a route (if necessary) that responds when other available methods are present.
in
AbstractRouteCollection at line 115
protected never
requestMethodNotAllowed(Request $request, array $others, string $method)
Throw a method not allowed HTTP exception.
in
AbstractRouteCollection at line 131
array
compile()
Compile the routes for caching.
in
AbstractRouteCollection at line 158
CompiledUrlMatcherDumper
dumper()
Return the CompiledUrlMatcherDumper instance for the route collection.
at line 253
RouteCollection
toSymfonyRouteCollection()
Convert the collection to a Symfony RouteCollection instance.
in
AbstractRouteCollection at line 194
protected RouteCollection
addToSymfonyRoutesCollection(RouteCollection $symfonyRoutes, Route $route)
Add a route to the SymfonyRouteCollection instance.
in
AbstractRouteCollection at line 222
protected string
generateRouteName()
Get a randomly generated route name.
in
AbstractRouteCollection at line 237
array
getWarmableRoutes()
Get the route instances that should be pre-warmed.
For RouteCollection, this is the same as getRoutes(). For CompiledRouteCollection, this returns the cached Route instances from $cachedRoutesByName that are actually used during matching, not throwaway objects from getRoutes().
in
AbstractRouteCollection at line 247
Traversable
getIterator()
Get an iterator for the items.
in
AbstractRouteCollection at line 255
int
count()
Count the number of items in the collection.
at line 57
protected void
addToCollections(Route $route)
Add the given route to the arrays of routes.
at line 93
protected void
addLookups(Route $route)
Add the route to any look-up tables if necessary.
at line 115
protected void
addToActionList(array $action, Route $route)
Add a route to the controller action dictionary.
at line 123
protected bool
inActionLookup(string $controller)
Determine if the given controller is in the action lookup table.
at line 131
protected bool
inNameLookup(string $name)
Determine if the given name is in the name lookup table.
at line 141
void
refreshNameLookups()
Refresh the name look-up table.
This is done in case any names are fluently defined or if routes are overwritten.
at line 157
void
refreshActionLookups()
Refresh the action look-up table.
This is done in case any actions are overwritten with new controllers.
at line 191
array
get(string|null $method = null)
Get routes from the collection by method.
at line 199
bool
hasNamedRoute(string $name)
Determine if the route collection contains a given named route.
at line 207
Route|null
getByName(string $name)
Get a route instance by its name.
at line 215
Route|null
getByAction(string $action)
Get a route instance by its controller action.
at line 225
array
getRoutes()
Get all of the routes in the collection.
at line 235
array
getRoutesByMethod()
Get all of the routes keyed by their HTTP verb / method.
at line 245
array
getRoutesByName()
Get all of the routes keyed by their name.
at line 265
CompiledRouteCollection
toCompiledRouteCollection(Router $router, Container $container)
Convert the collection to a CompiledRouteCollection instance.