$items
$items : array<mixed,mixed>
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.
__construct(array<mixed,\phpDocumentor\Descriptor\DescriptorAbstract>|array<mixed,mixed> $items = array())
Constructs a new collection object with optionally a series of items, generally Descriptors.
array<mixed,\phpDocumentor\Descriptor\DescriptorAbstract>|array<mixed,mixed> | $items |
add(\phpDocumentor\Descriptor\DescriptorAbstract|mixed $item) : void
Adds a new item to this collection, generally a Descriptor.
\phpDocumentor\Descriptor\DescriptorAbstract|mixed | $item |
set(string|integer $index, \phpDocumentor\Descriptor\DescriptorAbstract|mixed|null $item) : void
Sets a new object onto the collection or clear it using null.
string|integer | $index | An index value to recognize this item with. |
\phpDocumentor\Descriptor\DescriptorAbstract|mixed|null | $item | The item to store, generally a Descriptor but may be something else. |
get(string|integer $index, mixed $valueIfEmpty = null) : mixed
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.
string|integer | $index | |
mixed | $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.
merge(\phpDocumentor\Descriptor\Collection $collection) : \phpDocumentor\Descriptor\Collection
Returns a new collection with the items from this collection and the provided combined.
\phpDocumentor\Descriptor\Collection | $collection |