| Methods |
public
|
__clone()
|
#
|
public
|
getIterator(): ArrayIterator<string, Route>
Gets the current RouteCollection as an Iterator that includes all routes.
Gets the current RouteCollection as an Iterator that includes all routes.
It implements \IteratorAggregate.
Implements
|
#
|
public
|
count(): int
Gets the number of Routes in this collection.
Gets the number of Routes in this collection.
Implements
|
#
|
public
|
add(string $name, Route $route, int $priority = 0): void
|
#
|
public
|
all(): array<string, Route>
Returns all routes in this collection.
Returns all routes in this collection.
|
#
|
public
|
get(string $name): ?Route
Gets a route by name.
|
#
|
public
|
remove(string|string[] $name): void
Removes a route or an array of routes by name from the collection.
Removes a route or an array of routes by name from the collection.
Parameters
| $name |
The route name or an array of route names
|
|
#
|
public
|
addCollection(self $collection): void
Adds a route collection at the end of the current set by appending all
routes of the added collection.
Adds a route collection at the end of the current set by appending all
routes of the added collection.
|
#
|
public
|
addPrefix(string $prefix, array $defaults = [], array $requirements = []): void
Adds a prefix to the path of all child routes.
Adds a prefix to the path of all child routes.
|
#
|
public
|
addNamePrefix(string $prefix): void
Adds a prefix to the name of all the routes within in the collection.
Adds a prefix to the name of all the routes within in the collection.
|
#
|
public
|
setHost(?string $pattern, array $defaults = [], array $requirements = []): void
Sets the host pattern on all routes.
Sets the host pattern on all routes.
|
#
|
public
|
setCondition(?string $condition): void
Sets a condition on all routes.
Sets a condition on all routes.
Existing conditions will be overridden.
|
#
|
public
|
addDefaults(array $defaults): void
Adds defaults to all routes.
Adds defaults to all routes.
An existing default value under the same name in a route will be overridden.
|
#
|
public
|
addRequirements(array $requirements): void
Adds requirements to all routes.
Adds requirements to all routes.
An existing requirement under the same name in a route will be overridden.
|
#
|
public
|
addOptions(array $options): void
Adds options to all routes.
Adds options to all routes.
An existing option value under the same name in a route will be overridden.
|
#
|
public
|
setSchemes(string|string[] $schemes): void
Sets the schemes (e.g. 'https') all child routes are restricted to.
Sets the schemes (e.g. 'https') all child routes are restricted to.
Parameters
| $schemes |
The scheme or an array of schemes
|
|
#
|
public
|
setMethods(string|string[] $methods): void
Sets the HTTP methods (e.g. 'POST') all child routes are restricted to.
Sets the HTTP methods (e.g. 'POST') all child routes are restricted to.
Parameters
| $methods |
The method or an array of methods
|
|
#
|
public
|
getResources(): ResourceInterface[]
Returns an array of resources loaded to build this collection.
Returns an array of resources loaded to build this collection.
|
#
|
public
|
addResource(ResourceInterface $resource): void
Adds a resource for this collection. If the resource already exists
it is not added.
Adds a resource for this collection. If the resource already exists
it is not added.
|
#
|
public
|
addAlias(string $name, string $alias): Alias
Sets an alias for an existing route.
Sets an alias for an existing route.
Parameters
| $name |
The alias to create
|
| $alias |
The route to alias
|
Throws
|
#
|
public
|
getAliases(): array<string, Alias>
|
#
|
public
|
getAlias(string $name): ?Alias
|
#
|