$items
$items : \phpDocumentor\Descriptor\T[]
Represents an easily accessible collection of elements.
The goal for this class is to allow Descriptors to be easily retrieved and set so that interaction in templates becomes easier.
set(array-key $index, \phpDocumentor\Descriptor\T $item) : void
Sets a new object onto the collection or clear it using null.
array-key | $index | An index value to recognize this item with. |
\phpDocumentor\Descriptor\T | $item | The item to store, generally a Descriptor but may be something else. |
fetch(array-key $index, ?\phpDocumentor\Descriptor\TChild $valueIfEmpty = null) : \phpDocumentor\Descriptor\TChild
Retrieves a specific item from the Collection with its index.
Please note that this method (intentionally) has the side effect that whenever a key does not exist that it will be created with the value provided by the $valueIfEmpty argument. This will allow for easy initialization during tree building operations.
array-key | $index | |
?\phpDocumentor\Descriptor\TChild | $valueIfEmpty | If the index does not exist it will be created with this value and returned. |
The contents of the element with the given index and the provided default if the key doesn't exist.
offsetSet((array-key)|null $offset, \phpDocumentor\Descriptor\T $value) : void
Sets an item at the given index.
(array-key)|null | $offset | The offset to assign the value to. |
\phpDocumentor\Descriptor\T | $value | The value to set. |
If the key is null or an empty string.
merge(\phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\T> $collection) : \phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\T>
Returns a new collection with the items from this collection and the provided combined.
\phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\T> | $collection |
fromClassString(class-string<\phpDocumentor\Descriptor\C> $classString, \phpDocumentor\Descriptor\C[] $elements = []) : \phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\C>
class-string<\phpDocumentor\Descriptor\C> | $classString | |
\phpDocumentor\Descriptor\C[] | $elements |
fromInterfaceString(class-string<\phpDocumentor\Descriptor\C> $interfaceString, \phpDocumentor\Descriptor\C[] $elements = []) : \phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\C>
class-string<\phpDocumentor\Descriptor\C> | $interfaceString | |
\phpDocumentor\Descriptor\C[] | $elements |