for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace CCT\Component\Collections;
class Collection implements CollectionInterface
{
/**
* An array containing the entries of this collection.
*
* @var array
*/
protected $elements;
* Initializes a new ArrayCollection.
* @param array $elements
public function __construct(array $elements = [])
$this->elements = $elements;
}
* {@inheritdoc}
public function isEmpty(): bool
return empty($this->elements);
public function all(): array
return $this->elements;
public function count()
return count($this->elements);
public function first()
return reset($this->elements);
public function last()
return end($this->elements);
public function key()
return key($this->elements);
public function next()
return next($this->elements);
public function current()
return current($this->elements);
public function getIterator()
return new \ArrayIterator($this->elements);
* Returns a string representation of this object.
* @return string
public function __toString()
return __CLASS__ . '@' . spl_object_hash($this);