19 declare(strict_types=1);
    51         return $this->
get($offset);
    54     public function offsetSet(mixed $offset, mixed $value): void
    56         if (!isset($offset)) {
    62         $this->
set($offset, $value);
    67         $this->
remove($offset);
    72         return count($this->elements);
    75     public function add(mixed $element): void
    77         $this->elements[] = $element;
    80     public function remove(
string|
int $key): 
void    85         unset($this->elements[
$key]);
    90         $key = array_search($element, $this->elements, 
true);
    94         unset($this->elements[
$key]);
   105         return isset($this->elements[$key]) || array_key_exists($key, $this->elements);
   110         return array_search($element, $this->elements, 
true);
   115         $this->elements = [];
   120         return in_array($element, $this->elements, 
true);
   123     public function get(
string|
int $key): mixed
   125         return $this->elements[
$key] ?? null;
   128     public function set(
string|
int $key, mixed $value): 
void   130         $this->elements[
$key] = $value;
   135         return empty($this->elements);
   140         return array_keys($this->elements);
   145         return array_values($this->elements);
   148     public function filter(callable $callable): self
   150         return new static(array_filter($this->elements, $callable));
   153     public function slice(
int $offset, 
int $length = null): self
   155         return new static(array_slice($this->elements, $offset, $length, 
true));
   160         return $this->elements;
   163     public function equals(mixed $other): bool
   165         if (!($other instanceof 
self)) {
   170         $other = $other->toArray();
   175         return $self == $other;
 contains(mixed $element)
-param T $element 
 
getValues()
Gets all values of the collection. 
 
slice(int $offset, int $length=null)
Extracts a slice of $length elements starting at position $offset from the Collection. 
 
Interface ilBuddySystemCollection. 
 
add(mixed $element)
Adds an element at the end of the collection. 
 
offsetUnset(mixed $offset)
 
Class ilBuddySystemArrayCollection A generic array based collection class. 
 
offsetSet(mixed $offset, mixed $value)
 
offsetExists(mixed $offset)
 
filter(callable $callable)
Returns all the elements of this collection that satisfy the predicate $callable. ...
 
getKeys()
Gets all indices of the collection. 
 
containsKey(string|int $key)
isset is used for performance reasons (array_key_exists is much slower). 
 
__construct(private array $elements=[])
 
removeElement(mixed $element)