DumperPrefixCollection
class DumperPrefixCollection extends DumperCollection
Prefix tree of routes preserving routes order.
Methods
DumperCollection[]|DumperRoute[] | all() Returns the children routes and collections. | from DumperCollection |
add(DumperRoute|DumperCollection $child) Adds a route or collection. | from DumperCollection | |
setAll(array $children) Sets children. | from DumperCollection | |
Iterator|DumperCollection[]|DumperRoute[] | getIterator() Returns an iterator over the children. | from DumperCollection |
DumperCollection | getRoot() Returns the root of the collection. | from DumperCollection |
bool | hasAttribute(string $name) Returns true if the attribute is defined. | from DumperCollection |
mixed | getAttribute(string $name, mixed $default = null) Returns an attribute by name. | from DumperCollection |
setAttribute(string $name, mixed $value) Sets an attribute by name. | from DumperCollection | |
setAttributes(array $attributes) Sets multiple attributes. | from DumperCollection | |
string | getPrefix() Returns the prefix. | |
setPrefix(string $prefix) Sets the prefix. | ||
DumperPrefixCollection | addPrefixRoute(DumperRoute $route) Adds a route in the tree. | |
mergeSlashNodes() Merges nodes whose prefix ends with a slash. |
Details
DumperCollection[]|DumperRoute[] all()
Returns the children routes and collections.
Return Value
DumperCollection[]|DumperRoute[] | Array of DumperCollection|DumperRoute |
add(DumperRoute|DumperCollection $child)
Adds a route or collection.
Parameters
DumperRoute|DumperCollection | $child | The route or collection |
setAll(array $children)
Sets children.
Parameters
array | $children | The children |
Iterator|DumperCollection[]|DumperRoute[] getIterator()
Returns an iterator over the children.
Return Value
Iterator|DumperCollection[]|DumperRoute[] | The iterator |
DumperCollection getRoot()
Returns the root of the collection.
Return Value
DumperCollection | The root collection |
bool hasAttribute(string $name)
Returns true if the attribute is defined.
Parameters
string | $name | The attribute name |
Return Value
bool | true if the attribute is defined, false otherwise |
mixed getAttribute(string $name, mixed $default = null)
Returns an attribute by name.
Parameters
string | $name | The attribute name |
mixed | $default | Default value is the attribute doesn't exist |
Return Value
mixed | The attribute value |
setAttribute(string $name, mixed $value)
Sets an attribute by name.
Parameters
string | $name | The attribute name |
mixed | $value | The attribute value |
setAttributes(array $attributes)
Sets multiple attributes.
Parameters
array | $attributes | The attributes |
string getPrefix()
Returns the prefix.
Return Value
string | The prefix |
setPrefix(string $prefix)
Sets the prefix.
Parameters
string | $prefix | The prefix |
DumperPrefixCollection addPrefixRoute(DumperRoute $route)
Adds a route in the tree.
Parameters
DumperRoute | $route | The route |
Return Value
DumperPrefixCollection |
Exceptions
LogicException |
mergeSlashNodes()
Merges nodes whose prefix ends with a slash.
Children of a node whose prefix ends with a slash are moved to the parent node
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/4.0/Symfony/Component/Routing/Matcher/Dumper/DumperPrefixCollection.html