5interface Collection extends \ArrayAccess, \Countable, \IteratorAggregate
14 public function add($element);
46 public function map(\Closure $function);
53 public function filter(\Closure $filterFunction);
67 public function remove($element);
75 public function set(
$key, $value);
An exception for terminatinating execution or to throw for unit testing.
last()
Return the last element from the collection.
map(\Closure $function)
Applies the given function to each element in the collection and returns a new collection with the el...
add($element)
Add an element to the collection.
getOnlyElement()
Shorthand for getting a single element that also must be the only element in the collection.
first()
Return the first element from the collection.
filter(\Closure $filterFunction)