enqueue(...$collection); } /** * Enqueues an element * * @param mixed ...$elements * * @return $this */ public function enqueue(mixed ...$elements): self { array_unshift($this->array, ...$elements); return $this; } /** * Returns the element at the head or null if the queue is empty but doesn't remove that element * * @return mixed */ public function peek(): mixed { if ($this->size() > 0) { return $this->array[0]; } return null; } /** * Removes and returns the element at the head or null if the is empty * * @return mixed */ public function poll(): mixed { return array_shift($this->array); } }