RouteCollection
class RouteCollection implements IteratorAggregate, Countable
A RouteCollection represents a set of Route instances.
When adding a route at the end of the collection, an existing route with the same name is removed first. So there can only be one route with a given name.
Methods
No description
Gets the current RouteCollection as an Iterator that includes all routes.
Gets the number of Routes in this collection.
Removes a route or an array of routes by name from the collection.
Adds a route collection at the end of the current set by appending all routes of the added collection.
Adds a prefix to the path of all child routes.
Sets the host pattern on all routes.
Sets a condition on all routes.
Adds defaults to all routes.
Adds requirements to all routes.
Adds options to all routes.
Sets the schemes (e.g. 'https') all child routes are restricted to.
Sets the HTTP methods (e.g. 'POST') all child routes are restricted to.
Returns an array of resources loaded to build this collection.
Details
at line line 38
__clone()
at line line 54
ArrayIterator
getIterator()
Gets the current RouteCollection as an Iterator that includes all routes.
It implements \IteratorAggregate.
at line line 64
int
count()
Gets the number of Routes in this collection.
at line line 75
add(string $name, Route $route)
Adds a route.
at line line 87
Route[]
all()
Returns all routes in this collection.
at line line 99
Route|null
get(string $name)
Gets a route by name.
at line line 109
remove(string|array $name)
Removes a route or an array of routes by name from the collection.
at line line 122
addCollection(RouteCollection $collection)
Adds a route collection at the end of the current set by appending all routes of the added collection.
at line line 141
addPrefix(string $prefix, array $defaults = array(), array $requirements = array())
Adds a prefix to the path of all child routes.
at line line 163
setHost(string $pattern, array $defaults = array(), array $requirements = array())
Sets the host pattern on all routes.
at line line 179
setCondition(string $condition)
Sets a condition on all routes.
Existing conditions will be overridden.
at line line 193
addDefaults(array $defaults)
Adds defaults to all routes.
An existing default value under the same name in a route will be overridden.
at line line 209
addRequirements(array $requirements)
Adds requirements to all routes.
An existing requirement under the same name in a route will be overridden.
at line line 225
addOptions(array $options)
Adds options to all routes.
An existing option value under the same name in a route will be overridden.
at line line 239
setSchemes(string|array $schemes)
Sets the schemes (e.g. 'https') all child routes are restricted to.
at line line 251
setMethods(string|array $methods)
Sets the HTTP methods (e.g. 'POST') all child routes are restricted to.
at line line 263
ResourceInterface[]
getResources()
Returns an array of resources loaded to build this collection.
at line line 273
addResource(ResourceInterface $resource)
Adds a resource for this collection.