Documentation

RouteCollection
in package
implements Countable, IteratorAggregate

Interfaces, Classes and Traits

Countable
IteratorAggregate

Table of Contents

$actionList  : array<string|int, mixed>
A look-up table of routes by controller action.
$allRoutes  : array<string|int, mixed>
An flattened array of all of the routes.
$nameList  : array<string|int, mixed>
A look-up table of routes by their names.
$routes  : array<string|int, mixed>
An array of the routes keyed by method.
add()  : Route
Add a Route instance to the collection.
count()  : int
Count the number of items in the collection.
get()  : array<string|int, mixed>
Get routes from the collection by method.
getByAction()  : Route|null
Get a route instance by its controller action.
getByName()  : Route|null
Get a route instance by its name.
getIterator()  : ArrayIterator
Get an iterator for the items.
getRoutes()  : array<string|int, mixed>
Get all of the routes in the collection.
getRoutesByMethod()  : array<string|int, mixed>
Get all of the routes keyed by their HTTP verb / method.
getRoutesByName()  : array<string|int, mixed>
Get all of the routes keyed by their name.
hasNamedRoute()  : bool
Determine if the route collection contains a given named route.
match()  : Route
Find the first route matching a given request.
refreshActionLookups()  : void
Refresh the action look-up table.
refreshNameLookups()  : void
Refresh the name look-up table.
addLookups()  : void
Add the route to any look-up tables if necessary.
addToActionList()  : void
Add a route to the controller action dictionary.
addToCollections()  : void
Add the given route to the arrays of routes.
checkForAlternateVerbs()  : array<string|int, mixed>
Determine if any routes match on another HTTP verb.
getRouteForMethods()  : Route
Get a route (if necessary) that responds when other available methods are present.
matchAgainstRoutes()  : Route|null
Determine if a route in the array matches the request.
methodNotAllowed()  : void
Throw a method not allowed HTTP exception.

Properties

$actionList

A look-up table of routes by controller action.

protected array<string|int, mixed> $actionList = []

$allRoutes

An flattened array of all of the routes.

protected array<string|int, mixed> $allRoutes = []

$nameList

A look-up table of routes by their names.

protected array<string|int, mixed> $nameList = []

$routes

An array of the routes keyed by method.

protected array<string|int, mixed> $routes = []

Methods

count()

Count the number of items in the collection.

public count() : int
Return values
int

get()

Get routes from the collection by method.

public get([string|null $method = null ]) : array<string|int, mixed>
Parameters
$method : string|null = null
Return values
array<string|int, mixed>

getByAction()

Get a route instance by its controller action.

public getByAction(string $action) : Route|null
Parameters
$action : string
Return values
Route|null

getByName()

Get a route instance by its name.

public getByName(string $name) : Route|null
Parameters
$name : string
Return values
Route|null

getIterator()

Get an iterator for the items.

public getIterator() : ArrayIterator
Return values
ArrayIterator

getRoutes()

Get all of the routes in the collection.

public getRoutes() : array<string|int, mixed>
Return values
array<string|int, mixed>

getRoutesByMethod()

Get all of the routes keyed by their HTTP verb / method.

public getRoutesByMethod() : array<string|int, mixed>
Return values
array<string|int, mixed>

getRoutesByName()

Get all of the routes keyed by their name.

public getRoutesByName() : array<string|int, mixed>
Return values
array<string|int, mixed>

hasNamedRoute()

Determine if the route collection contains a given named route.

public hasNamedRoute(string $name) : bool
Parameters
$name : string
Return values
bool

refreshActionLookups()

Refresh the action look-up table.

public refreshActionLookups() : void

This is done in case any actions are overwritten with new controllers.

Return values
void

refreshNameLookups()

Refresh the name look-up table.

public refreshNameLookups() : void

This is done in case any names are fluently defined or if routes are overwritten.

Return values
void

addLookups()

Add the route to any look-up tables if necessary.

protected addLookups(Route $route) : void
Parameters
$route : Route
Return values
void

addToActionList()

Add a route to the controller action dictionary.

protected addToActionList(array<string|int, mixed> $action, Route $route) : void
Parameters
$action : array<string|int, mixed>
$route : Route
Return values
void

addToCollections()

Add the given route to the arrays of routes.

protected addToCollections(Route $route) : void
Parameters
$route : Route
Return values
void

checkForAlternateVerbs()

Determine if any routes match on another HTTP verb.

protected checkForAlternateVerbs(Request $request) : array<string|int, mixed>
Parameters
$request : Request
Return values
array<string|int, mixed>

matchAgainstRoutes()

Determine if a route in the array matches the request.

protected matchAgainstRoutes(array<string|int, mixed> $routes, Request $request[, bool $includingMethod = true ]) : Route|null
Parameters
$routes : array<string|int, mixed>
$request : Request
$includingMethod : bool = true
Return values
Route|null

methodNotAllowed()

Throw a method not allowed HTTP exception.

protected methodNotAllowed(array<string|int, mixed> $others) : void
Parameters
$others : array<string|int, mixed>
Tags
throws
MethodNotAllowedHttpException
Return values
void

Search results