A read-only interface to a (possibly mutable) group of items. More...
|filter (callable $filter)|
|Returns a new collection only containing the elements which pass the filter. More...|
|Returns true iff the item is in this collection at least once. More...|
|map (callable $mapper)|
|Take items of the collection and return a new collection with all the items having the $mapper applied to them. More...|
A read-only interface to a (possibly mutable) group of items.
Read-only provides some nice guarantees that can be harnessed for things like caching, lazy evaluation, respecting HTTP semantics of GET/HEAD, etc.
We do not extend ArrayAccess, because:
Extensions may provide one or more of these features.
TODO(ewinslow): If PHP had generics support, we'd add that here.
DO NOT EXTEND OR IMPLEMENT this interface outside of this package. Doing so would cause additions to the API to be breaking changes, which is not what we want. You have a couple of options for how to proceed:
Returns true iff the item is in this collection at least once.
|mixed||$item||The object or value to check for|
Implemented in Elgg\Structs\Collection\InMemory.