* * @template TKey of array-key * @template T * @extends \IteratorAggregate */ interface DomainCollection extends \Countable, \IteratorAggregate { public function isEmpty(): bool; /** * @param T $element */ public function contains($element): bool; /** * @param TKey $key */ public function containsKey($key): bool; /** * @return T */ public function first(); /** * @return T */ public function last(); /** * @param TKey $key * * @return T */ public function get($key); /** * @param callable(T):bool $filter * * @return static */ public function filter(callable $filter): self; /** * @return static */ public function slice(int $offset, int $limit = 0): self; /** * @template T2 * * @param callable(T):T2 $mapper * * @return static */ public function map(callable $mapper): self; }