RouteCollection
class RouteCollection implements Countable, IteratorAggregate (View source)
Properties
protected array | $routes | An array of the routes keyed by method. | |
protected array | $allRoutes | An flattened array of all of the routes. | |
protected array | $nameList | A look-up table of routes by their names. | |
protected array | $actionList | A look-up table of routes by controller action. |
Methods
Refresh the name look-up table.
Refresh the action look-up table.
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.
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.
Get an iterator for the items.
Count the number of items in the collection.
Details
at line 65
protected void
addToCollections(Route $route)
Add the given route to the arrays of routes.
at line 82
protected void
addLookups(Route $route)
Add the route to any look-up tables if necessary.
at line 108
protected void
addToActionList(array $action, Route $route)
Add a route to the controller action dictionary.
at line 120
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 138
void
refreshActionLookups()
Refresh the action look-up table.
This is done in case any actions are overwritten with new controllers.
at line 190
protected Route|null
matchAgainstRoutes(array $routes, Request $request, bool $includingMethod = true)
Determine if a route in the array matches the request.
at line 207
protected array
checkForAlternateVerbs(Request $request)
Determine if any routes match on another HTTP verb.
at line 234
protected Route
getRouteForMethods(Request $request, array $methods)
Get a route (if necessary) that responds when other available methods are present.
at line 253
protected void
methodNotAllowed(array $others)
Throw a method not allowed HTTP exception.
at line 264
array
get(string|null $method = null)
Get routes from the collection by method.
at line 275
bool
hasNamedRoute(string $name)
Determine if the route collection contains a given named route.
at line 307
array
getRoutes()
Get all of the routes in the collection.
at line 317
array
getRoutesByMethod()
Get all of the routes keyed by their HTTP verb / method.
at line 327
array
getRoutesByName()
Get all of the routes keyed by their name.
at line 337
ArrayIterator
getIterator()
Get an iterator for the items.
at line 347
int
count()
Count the number of items in the collection.