19 declare(strict_types=1);
47 return $this->
get($offset);
52 if (!isset($offset)) {
58 $this->
set($offset, $value);
63 $this->
remove($offset);
68 return count($this->elements);
73 $this->elements[] = $element;
76 public function remove(
$key):
void 81 unset($this->elements[
$key]);
86 $key = array_search($element, $this->elements,
true);
90 unset($this->elements[
$key]);
95 return isset($this->elements[
$key]);
100 $key = array_search($element, $this->elements,
true);
101 if (
false ===
$key) {
109 $this->elements = [];
114 return in_array($element, $this->elements,
true);
119 return $this->elements[
$key] ?? null;
124 $this->elements[
$key] = $value;
129 return empty($this->elements);
134 return array_keys($this->elements);
139 return array_values($this->elements);
144 $filtered = array_filter($this->elements, $callable);
145 return new self($filtered);
150 $sliced = array_slice($this->elements, $offset, $length,
true);
151 return new self($sliced);
156 return $this->elements;
161 if (!$other instanceof
self) {
166 $other = $other->toArray();
171 return $self === $other;
offsetSet(int $offset, AutoresponderDto $value)
offsetExists(int $offset)
getKey(AutoresponderDto $element)
filter(callable $callable)
slice(int $offset, int $length=null)
add(AutoresponderDto $element)
__construct(private array $elements=[])
removeElement(AutoresponderDto $element)
contains(AutoresponderDto $element)