Navigation node collection.
More...
|
| add (navigation_node $node, $beforekey=null) |
| Adds a navigation node to the collection.
|
|
| count () |
| Gets the number of nodes in this collection.
|
|
| find ($key, $type=null) |
| Searches for a node with matching key and type.
|
|
| get ($key, $type=null) |
| Fetches a node from this collection.
|
|
| get_collectionlabel () |
| Return a label for this collection.
|
|
| get_key_list () |
| Return a list of all the keys of all the nodes.
|
|
| getIterator () |
| Gets an array iterator for the collection.
|
|
| last () |
| Fetches the last node that was added to this collection.
|
|
| remove ($key, $type=null) |
| Removes the node with the given key and type from the collection.
|
|
| set_collectionlabel ($label) |
| Set a label for this collection.
|
|
| type ($type) |
| Fetches all nodes of a given type from this collection.
|
|
|
array | $collection = array() |
| A multidimensional array to where the first key is the type and the second key is the nodes key.
|
|
string | $collectionlabel = '' |
| Label for collection of nodes.
|
|
int | $count = 0 |
| The total number of items added to this array.
|
|
navigation_node | $last = null |
| A reference to the last node that was added to the collection.
|
|
array | $orderedcollection = array() |
| An array that contains references to nodes in the same order they were added.
|
|
Navigation node collection.
This class is responsible for managing a collection of navigation nodes. It is required because a node's unique identifier is a combination of both its key and its type.
Originally an array was used with a string key that was a combination of the two however it was decided that a better solution would be to use a class that implements the standard IteratorAggregate interface.
- Copyright
- 2010 Sam Hemelryk
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ add()
navigation_node_collection::add |
( |
navigation_node | $node, |
|
|
| $beforekey = null ) |
Adds a navigation node to the collection.
- Parameters
-
navigation_node | $node | Node to add |
string | $beforekey | If specified, adds before a node with this key, otherwise adds at end |
- Return values
-
Reimplemented in flat_navigation.
◆ count()
navigation_node_collection::count |
( |
| ) |
|
Gets the number of nodes in this collection.
This option uses an internal count rather than counting the actual options to avoid a performance hit through the count function.
- Return values
-
◆ find()
navigation_node_collection::find |
( |
| $key, |
|
|
| $type = null ) |
Searches for a node with matching key and type.
This function searches both the nodes in this collection and all of the nodes in each collection belonging to the nodes in this collection.
Recursive.
- Parameters
-
string | int | $key | The key of the node we want to find. |
int | $type | One of navigation_node\TYPE_*. |
- Return values
-
◆ get()
navigation_node_collection::get |
( |
| $key, |
|
|
| $type = null ) |
Fetches a node from this collection.
- Parameters
-
string | int | $key | The key of the node we want to find. |
int | $type | One of navigation_node\TYPE_*. |
- Return values
-
navigation_node|null|false | |
◆ get_collectionlabel()
navigation_node_collection::get_collectionlabel |
( |
| ) |
|
Return a label for this collection.
- Return values
-
◆ get_key_list()
navigation_node_collection::get_key_list |
( |
| ) |
|
Return a list of all the keys of all the nodes.
- Return values
-
◆ getIterator()
navigation_node_collection::getIterator |
( |
| ) |
|
Gets an array iterator for the collection.
This is required by the IteratorAggregator interface and is used by routines such as the foreach loop.
- Return values
-
◆ last()
navigation_node_collection::last |
( |
| ) |
|
Fetches the last node that was added to this collection.
- Return values
-
◆ remove()
navigation_node_collection::remove |
( |
| $key, |
|
|
| $type = null ) |
Removes the node with the given key and type from the collection.
- Parameters
-
string | int | $key | The key of the node we want to find. |
int | $type | |
- Return values
-
◆ set_collectionlabel()
navigation_node_collection::set_collectionlabel |
( |
| $label | ) |
|
Set a label for this collection.
- Parameters
-
◆ type()
navigation_node_collection::type |
( |
| $type | ) |
|
Fetches all nodes of a given type from this collection.
- Parameters
-
string | int | $type | node type being searched for. |
- Return values
-
◆ $orderedcollection
array navigation_node_collection::$orderedcollection = array() |
|
protected |
An array that contains references to nodes in the same order they were added.
This is maintained as a progressive array.
The documentation for this class was generated from the following file: