public function replace(string $data): string
    {
        if (!$this->valid()) {
            throw new OutOfBoundsException('The iterator is not valid!');
        }
        
        $temp = $this->buffer[$this->current];
        
        $this->buffer[$this->current] = $data;
        
        return $temp;
    }