class DumperPrefixCollection extends DumperCollection

Prefix tree of routes preserving routes order.

Methods

(DumperCollection|DumperRoute)[]
all()

Returns the children routes and collections.

add(DumperRoute|DumperCollection $child)

Adds a route or collection.

setAll(array $children)

Sets children.

getIterator()

Returns an iterator over the children.

getRoot()

Returns the root of the collection.

bool
hasAttribute(string $name)

Returns true if the attribute is defined.

mixed
getAttribute(string $name, mixed $default = null)

Returns an attribute by name.

setAttribute(string $name, mixed $value)

Sets an attribute by name.

setAttributes(array $attributes)

Sets multiple attributes.

string
getPrefix()

Returns the prefix.

setPrefix(string $prefix)

Sets the prefix.

addPrefixRoute(DumperRoute $route)

Adds a route in the tree.

mergeSlashNodes()

Merges nodes whose prefix ends with a slash.

Details

in DumperCollection at line line 43
(DumperCollection|DumperRoute)[] all()

Returns the children routes and collections.

Return Value

(DumperCollection|DumperRoute)[] Array of DumperCollection|DumperRoute

in DumperCollection at line line 53
add(DumperRoute|DumperCollection $child)

Adds a route or collection.

Parameters

DumperRoute|DumperCollection $child The route or collection

in DumperCollection at line line 66
setAll(array $children)

Sets children.

Parameters

array $children The children

in DumperCollection at line line 81
Iterator getIterator()

Returns an iterator over the children.

Return Value

Iterator The iterator

in DumperCollection at line line 91
DumperCollection getRoot()

Returns the root of the collection.

Return Value

DumperCollection The root collection

in DumperCollection at line line 123
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

in DumperCollection at line line 136
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

in DumperCollection at line line 147
setAttribute(string $name, mixed $value)

Sets an attribute by name.

Parameters

string $name The attribute name
mixed $value The attribute value

in DumperCollection at line line 157
setAttributes(array $attributes)

Sets multiple attributes.

Parameters

array $attributes The attributes

at line line 33
string getPrefix()

Returns the prefix.

Return Value

string The prefix

at line line 43
setPrefix(string $prefix)

Sets the prefix.

Parameters

string $prefix The prefix

at line line 57
DumperPrefixCollection addPrefixRoute(DumperRoute $route)

Adds a route in the tree.

Parameters

DumperRoute $route The route

Return Value

DumperPrefixCollection The node the route was added to

Exceptions

LogicException

at line line 88
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