RouteCollectionBuilder
in package
Helps add and import routes into a RouteCollection.
Tags
Table of Contents
- $condition : mixed
- $defaults : mixed
- $host : mixed
- $loader : mixed
- $methods : mixed
- $options : mixed
- $prefix : mixed
- $requirements : mixed
- $resources : mixed
- $routes : array<string|int, Route>|array<string|int, RouteCollectionBuilder>
- $schemes : mixed
- __construct() : mixed
- add() : Route
- Adds a route and returns it for future modification.
- addRoute() : $this
- Adds a Route object to the builder.
- build() : RouteCollection
- Creates the final RouteCollection and returns it.
- createBuilder() : self
- Returns a RouteCollectionBuilder that can be configured and then added with mount().
- import() : self
- Import an external routing resource and returns the RouteCollectionBuilder.
- mount() : mixed
- Add a RouteCollectionBuilder.
- setCondition() : $this
- Sets a condition on all embedded routes (unless already set).
- setDefault() : $this
- Sets a default value that will be added to all embedded routes (unless that default value is already set).
- setHost() : $this
- Sets the host on all embedded routes (unless already set).
- setMethods() : $this
- Sets the methods on all embedded routes (unless already set).
- setOption() : $this
- Sets an option that will be added to all embedded routes (unless that option is already set).
- setRequirement() : $this
- Sets a requirement that will be added to all embedded routes (unless that requirement is already set).
- setSchemes() : $this
- Sets the schemes on all embedded routes (unless already set).
- addResource() : $this
- Adds a resource for this collection.
- generateRouteName() : string
- Generates a route name based on details of this route.
- load() : array<string|int, RouteCollection>
- Finds a loader able to load an imported resource and loads it.
Properties
$condition
private
mixed
$condition
$defaults
private
mixed
$defaults
= []
$host
private
mixed
$host
$loader
private
mixed
$loader
$methods
private
mixed
$methods
$options
private
mixed
$options
= []
$prefix
private
mixed
$prefix
$requirements
private
mixed
$requirements
= []
$resources
private
mixed
$resources
= []
$routes
private
array<string|int, Route>|array<string|int, RouteCollectionBuilder>
$routes
= []
$schemes
private
mixed
$schemes
Methods
__construct()
public
__construct([LoaderInterface|null $loader = null ]) : mixed
Parameters
- $loader : LoaderInterface|null = null
Return values
mixed —add()
Adds a route and returns it for future modification.
public
add(string $path, string $controller[, string|null $name = null ]) : Route
Parameters
- $path : string
- $controller : string
- $name : string|null = null
Return values
Route —addRoute()
Adds a Route object to the builder.
public
addRoute(Route $route[, string|null $name = null ]) : $this
Parameters
- $route : Route
- $name : string|null = null
Return values
$this —build()
Creates the final RouteCollection and returns it.
public
build() : RouteCollection
Return values
RouteCollection —createBuilder()
Returns a RouteCollectionBuilder that can be configured and then added with mount().
public
createBuilder() : self
Return values
self —import()
Import an external routing resource and returns the RouteCollectionBuilder.
public
import(mixed $resource[, string $prefix = '/' ][, string|null $type = null ]) : self
$routes->import('blog.yml', '/blog');
Parameters
- $resource : mixed
- $prefix : string = '/'
- $type : string|null = null
Tags
Return values
self —mount()
Add a RouteCollectionBuilder.
public
mount(string $prefix, self $builder) : mixed
Parameters
- $prefix : string
- $builder : self
Return values
mixed —setCondition()
Sets a condition on all embedded routes (unless already set).
public
setCondition(string|null $condition) : $this
Parameters
- $condition : string|null
Return values
$this —setDefault()
Sets a default value that will be added to all embedded routes (unless that default value is already set).
public
setDefault(string $key, mixed $value) : $this
Parameters
- $key : string
- $value : mixed
Return values
$this —setHost()
Sets the host on all embedded routes (unless already set).
public
setHost(string|null $pattern) : $this
Parameters
- $pattern : string|null
Return values
$this —setMethods()
Sets the methods on all embedded routes (unless already set).
public
setMethods(array<string|int, mixed>|string $methods) : $this
Parameters
- $methods : array<string|int, mixed>|string
Return values
$this —setOption()
Sets an option that will be added to all embedded routes (unless that option is already set).
public
setOption(string $key, mixed $value) : $this
Parameters
- $key : string
- $value : mixed
Return values
$this —setRequirement()
Sets a requirement that will be added to all embedded routes (unless that requirement is already set).
public
setRequirement(string $key, mixed $regex) : $this
Parameters
- $key : string
- $regex : mixed
Return values
$this —setSchemes()
Sets the schemes on all embedded routes (unless already set).
public
setSchemes(array<string|int, mixed>|string $schemes) : $this
Parameters
- $schemes : array<string|int, mixed>|string
Return values
$this —addResource()
Adds a resource for this collection.
private
addResource(ResourceInterface $resource) : $this
Parameters
- $resource : ResourceInterface
Return values
$this —generateRouteName()
Generates a route name based on details of this route.
private
generateRouteName(Route $route) : string
Parameters
- $route : Route
Return values
string —load()
Finds a loader able to load an imported resource and loads it.
private
load(mixed $resource[, string|null $type = null ]) : array<string|int, RouteCollection>
Parameters
- $resource : mixed
-
A resource
- $type : string|null = null
-
The resource type or null if unknown