RouteCollection
class RouteCollection extends AbstractRouteCollection (View source)
Properties
protected array | $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.
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.
Refresh the name look-up table.
Refresh the action look-up table.
Determine if the route collection contains a given named route.
Get a route instance by its controller action.
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
protected array
checkForAlternateVerbs(Request $request)
Determine if any routes match on another HTTP verb.
protected Route|null
matchAgainstRoutes(array $routes, Request $request, bool $includingMethod = true)
Determine if a route in the array matches the request.
protected Route
getRouteForMethods(Request $request, array $methods)
Get a route (if necessary) that responds when other available methods are present.
protected never
requestMethodNotAllowed(Request $request, array $others, string $method)
Throw a method not allowed HTTP exception.
protected void
methodNotAllowed(array $others, string $method)
deprecated
deprecated
Throw a method not allowed HTTP exception.
array
compile()
Compile the routes for caching.
CompiledUrlMatcherDumper
dumper()
Return the CompiledUrlMatcherDumper instance for the route collection.
RouteCollection
toSymfonyRouteCollection()
Convert the collection to a Symfony RouteCollection instance.
protected RouteCollection
addToSymfonyRoutesCollection(RouteCollection $symfonyRoutes, Route $route)
Add a route to the SymfonyRouteCollection instance.
protected string
generateRouteName()
Get a randomly generated route name.
Traversable
getIterator()
Get an iterator for the items.
int
count()
Count the number of items in the collection.
protected void
addToCollections(Route $route)
Add the given route to the arrays of routes.
protected void
addLookups(Route $route)
Add the route to any look-up tables if necessary.
protected void
addToActionList(array $action, Route $route)
Add a route to the controller action dictionary.
void
refreshNameLookups()
Refresh the name look-up table.
This is done in case any names are fluently defined or if routes are overwritten.
void
refreshActionLookups()
Refresh the action look-up table.
This is done in case any actions are overwritten with new controllers.
Route[]
get(string|null $method = null)
Get routes from the collection by method.
bool
hasNamedRoute(string $name)
Determine if the route collection contains a given named route.
Route|null
getByName(string $name)
Get a route instance by its name.
Route|null
getByAction(string $action)
Get a route instance by its controller action.
Route[]
getRoutes()
Get all of the routes in the collection.
array
getRoutesByMethod()
Get all of the routes keyed by their HTTP verb / method.
Route[]
getRoutesByName()
Get all of the routes keyed by their name.
CompiledRouteCollection
toCompiledRouteCollection(Router $router, Container $container)
Convert the collection to a CompiledRouteCollection instance.