PhpBench\Storage\Driver\Xml\HistoryIterator::init PHP Method

init() private method

private init ( )
    private function init()
    {
        if ($this->initialized) {
            return;
        }
        $this->initialized = true;
        if (file_exists($this->path)) {
            $this->years = $this->getDirectoryIterator($this->path);
        } else {
            $this->years = new \ArrayIterator();
        }
        // create directory iterators for each part of the date sharding
        // (2016/01/01/<hash>.xml). if there is not valid entries for the
        // preceding shard, just create an empty array iterator.
        if ($this->years->valid()) {
            $this->months = $this->getDirectoryIterator($this->years->current());
        } else {
            $this->months = new \ArrayIterator();
        }
        if ($this->months->valid()) {
            $this->days = $this->getDirectoryIterator($this->months->current());
        } else {
            $this->days = new \ArrayIterator();
        }
        if ($this->days->valid()) {
            $this->entries = $this->getEntryIterator();
        } else {
            $this->entries = new \ArrayIterator();
        }
    }