position = 0; } /** * Rewind the iterator to the first element. * * @return void */ public function rewind(): void { $this->position = 0; } /** * Current element in the collection. * * @return mixed */ public function current() { return $this->items[ $this->position ]; } /** * Get the current key * * @return int */ public function key(): int { return $this->position; } /** * Next element in the collection. * * @return void */ public function next(): void { ++$this->position; } /** * Check if the current position is valid. * * @return bool */ public function valid(): bool { return isset( $this->items[ $this->position ] ); } }