HEX
Server: Apache
System: Linux server1.ariadata.co 4.18.0-553.120.1.el8_10.x86_64 #1 SMP Mon Apr 20 18:04:27 EDT 2026 x86_64
User: nepi (1051)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system,show_source,popen,proc_open
Upload Files
File: /home/nepi/public_html/src/core/Directus/Database/ResultSet.php
<?php

namespace Directus\Database;

use Zend\Db\Adapter\Driver\Pdo\Result;
use Zend\Db\Adapter\Driver\ResultInterface;

class ResultSet implements \Iterator, ResultInterface
{
    /**
     * @var Result
     */
    protected $dataSource;

    /**
     * @var int|null
     */
    protected $fieldCount = null;

    public function __construct($dataSource = null)
    {
        if ($dataSource) {
            $this->initialize($dataSource);
        }
    }

    /**
     * @inheritDoc
     */
    public function initialize($dataSource)
    {
        if (is_array($dataSource)) {
            $first = current($dataSource);
            reset($dataSource);
            $this->fieldCount = count($first);
            $this->dataSource = new \ArrayIterator($dataSource);
        } else {
            $this->dataSource = $dataSource;
        }

        return $this;
    }

    /**
     * @inheritDoc
     */
    public function getFieldCount()
    {
        return $this->dataSource->getFieldCount();
    }

    /**
     * @inheritDoc
     */
    public function count()
    {
        return $this->dataSource->count();
    }

    /**
     * @inheritDoc
     */
    public function current()
    {
        return new ResultItem($this->dataSource->current());
    }

    /**
     * @inheritDoc
     */
    public function next()
    {
        return $this->dataSource->next();
    }

    /**
     * @inheritDoc
     */
    public function key()
    {
        return $this->dataSource->key();
    }

    /**
     * @inheritDoc
     */
    public function valid()
    {
        return $this->dataSource->valid();
    }

    /**
     * @inheritDoc
     */
    public function rewind()
    {
        $this->dataSource->rewind();
    }

    /**
     * @return array
     */
    public function toArray()
    {
        return iterator_to_array($this->dataSource);
    }

    /**
     * @inheritDoc
     */
    public function buffer()
    {
        return $this->dataSource->buffer();
    }

    /**
     * @inheritDoc
     */
    public function isBuffered()
    {
        return $this->dataSource->isBuffered();
    }

    /**
     * @inheritDoc
     */
    public function isQueryResult()
    {
        return $this->dataSource->isQueryResult();
    }

    /**
     * @inheritDoc
     */
    public function getAffectedRows()
    {
        return $this->dataSource->getAffectedRows();
    }

    /**
     * @inheritDoc
     */
    public function getGeneratedValue()
    {
        return $this->dataSource->getGeneratedValue();
    }

    /**
     * @inheritDoc
     */
    public function getResource()
    {
        return $this->dataSource->getResource();
    }
}