API Documentation (v0.9.0-alpha)

Avolutions\Routing\RouteCollection

implements CollectionInterface Uses CollectionTrait

The RouteCollection contains all registered routes (Route objects). The Router class will search in the RouteCollection for a matching route for the Request.

Properties

Property Visibility Type Description
$items public array The items of the Collection.

Methods

Method Visibility Description
addRoute() public Adds a given Route object to the RouteCollection.
count() public Returns the number of items in the Collection.
getAll() public Returns all items of the Collection.
getAllByMethod() public Returns an array with all Routes of the RouteCollection filtered by the method.

Property Details

$items

The items of the Collection.

public array<string|int, mixed> $items = []

Method Details

addRoute()

Adds a given Route object to the RouteCollection.

public addRoute(Route $Route) : mixed
Parameters

Route $Route
A Route object to add to the collection

Return values
mixed Adds a given Route object to the RouteCollection.
count()

Returns the number of items in the Collection.

public count() : int
Return values
int Returns the number of items in the Collection.
getAll()

Returns all items of the Collection.

public getAll() : array<string|int, mixed>
Return values
array<string|int, mixed> Returns all items of the Collection.
getAllByMethod()

Returns an array with all Routes of the RouteCollection filtered by the method.

public getAllByMethod(string $method) : array<string|int, mixed>
Parameters

string $method
Name of the method (GET|POST)

Return values
array<string|int, mixed> Returns an array with all Routes of the RouteCollection filtered by the method.