Doctrine\Common\Collections\ArrayCollection
An ArrayCollection is a Collection implementation that wraps a regular PHP array.
- Author: Guilherme Blanco <guilhermeblanco@hotmail.com>
Synopsis
class ArrayCollection
implements
Collection,Selectable
{
- // members
- private array $_elements;
- // methods
- public void __construct()
- public array toArray()
- public mixed first()
- public mixed last()
- public mixed key()
- public mixed next()
- public mixed current()
- public mixed remove()
- public boolean removeElement()
- public bool offsetExists()
- public mixed offsetGet()
- public bool offsetSet()
- public mixed offsetUnset()
- public boolean containsKey()
- public boolean contains()
- public boolean exists()
- public mixed indexOf()
- public mixed get()
- public array getKeys()
- public array getValues()
- public integer count()
- public void set()
- public boolean add()
- public boolean isEmpty()
- public ArrayIterator getIterator()
- public Collection map()
- public Collection filter()
- public boolean forAll()
- public array partition()
- public string __toString()
- public void clear()
- public array slice()
- public Collection matching()
Hierarchy
Members
private
- $_elements
—
array
An array containing the entries of this collection.
Methods
public
- __construct() — Initializes a new ArrayCollection.
- __toString() — Returns a string representation of this object.
- add() — Adds an element to the collection.
- clear() — Clears the collection.
- contains() — Checks whether the given element is contained in the collection.
- containsKey() — Checks whether the collection contains a specific key/index.
- count() — Returns the number of elements in the collection.
- current() — Gets the element of the collection at the current internal iterator position.
- exists() — Tests for the existence of an element that satisfies the given predicate.
- filter() — Returns all the elements of this collection that satisfy the predicate p.
- first() — Sets the internal iterator to the first element in the collection and returns this element.
- forAll() — Applies the given predicate p to all elements of this collection, returning true, if the predicate yields true for all elements.
- get() — Gets the element with the given key/index.
- getIterator() — Gets an iterator for iterating over the elements in the collection.
- getKeys() — Gets all keys/indexes of the collection elements.
- getValues() — Gets all elements.
- indexOf() — Searches for a given element and, if found, returns the corresponding key/index of that element. The comparison of two elements is strict, that means not only the value but also the type must match.
- isEmpty() — Checks whether the collection is empty.
- key() — Gets the current key/index at the current internal iterator position.
- last() — Sets the internal iterator to the last element in the collection and returns this element.
- map() — Applies the given function to each element in the collection and returns a new collection with the elements returned by the function.
- matching() — Select all elements from a selectable that match the criteria and return a new collection containing these elements.
- next() — Moves the internal iterator position to the next element.
- offsetExists() — ArrayAccess implementation of offsetExists()
- offsetGet() — ArrayAccess implementation of offsetGet()
- offsetSet() — ArrayAccess implementation of offsetSet()
- offsetUnset() — ArrayAccess implementation of offsetUnset()
- partition() — Partitions this collection in two collections according to a predicate.
- remove() — Removes an element with a specific key/index from the collection.
- removeElement() — Removes the specified element from the collection, if it is found.
- set() — Adds/sets an element in the collection at the index / with the specified key.
- slice() — Extract a slice of $length elements starting at position $offset from the Collection.
- toArray() — Gets the PHP array representation of this collection.