public function toArray()
    {
        if (\is_array($this->data)) {
            return $this->data;
        }

        if ($this->data instanceof \ArrayIterator) {
            return iterator_to_array($this->data, false);
        }

        if ($this->data instanceof \IteratorAggregate) {
            return iterator_to_array($this->data->getIterator(), false);
        }

        throw new ArrayConversionException('Cannot convert data to array');
    }