20 private function __construct(
protected array
$items = []) {
27 return in_array(
$item, $this->items,
true);
33 #[\ReturnTypeWillChange] 35 return count($this->items);
41 #[\ReturnTypeWillChange] 52 foreach ($this->items as
$item) {
64 #[\ReturnTypeWillChange] 65 public function key() {
66 return key($this->items);
72 public function map(callable $mapper) {
74 foreach ($this->items as
$item) {
84 #[\ReturnTypeWillChange] 86 return next($this->items);
92 #[\ReturnTypeWillChange] 100 #[\ReturnTypeWillChange] 102 return key($this->items) !== null;
static fromArray(array $items)
Factory function for converting from an array to a ton of items.
map(callable $mapper)
Take items of the collection and return a new collection with all the items having the $mapper applie...
Uses native PHP array to implement the Collection interface.
contains($item)
Returns true iff the item is in this collection at least once.The object or value to check forboolean...
filter(callable $filter)
Returns a new collection only containing the elements which pass the filter.Receives an item...
$filter
Layout content filter.
A read-only interface to a (possibly mutable) group of items.