Implementation of IteratorAggregate::getIterator(), allows to cycle through properties
and use {@link convert_to_array()}

@return ArrayIterator
976694
public function getIterator() {
        $ret = array();
        foreach (get_object_vars($this) as $key => $value) {
            if (substr($key, 0, 1) == '_') {
                if (method_exists($this, 'get'.$key)) {
                    $ret[substr($key, 1)] = $this->{'get'.$key}();
                } else {
                    $ret[substr($key, 1)] = $this->$key;
                }
            }
        }
        $ret['sequence'] = $this->get_sequence();
        $ret['course'] = $this->get_course();
        $ret = array_merge($ret, course_get_format($this->modinfo->get_course())->get_format_options($this->_section));
        return new ArrayIterator($ret);
    }
444375
public function getInnerIterator()
    {
        if (is_callable($this->inner)) {
            // callable
            $this->inner = call_user_func($this->inner);
        }

        if (is_array($this->inner)) {
            // array
            $this->inner = new \ArrayIterator($this->inner);
        } elseif ($this->inner instanceof \IteratorAggregate) {
            // IteratorAggregate
            while ($this->inner instanceof \IteratorAggregate) {
                $this->inner = $this->inner->getIterator();
            }
        }

        if (!$this->inner instanceof \Iterator) {
            throw new UnexpectedTypeException($this->inner, 'Iterator');
        }

        return $this->inner;
    }
314412
public function getIterator()
    {
        $chars = array();

        for ($i = 0, $l = $this->getLength(); $i < $l; $i++)
        {
            $chars[] = $this[$i];
        }

        return new \ArrayIterator($chars);
    }
759148
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');
    }
492677
public function getIterator(): \Generator
    {
        foreach ($this->sourceIterable as $content) {
            try {
                yield $this->stream->write($content);
            } catch (\InvalidArgumentException $ex) {
                throw new \RuntimeException('The iterable generated values that are not writable', 0, $ex);
            }
        }
    }
283635
public function getIterator()
    {
        $header = $this->getHeader();

        while ($data = $this->getNextDataSet()) {
            $headerColumns = count($header);
            $dataColumns   = count($data);

            if ($headerColumns > $dataColumns && $this->appendRowsColumns) {
                $data = array_pad($data, $headerColumns, '');
                $this->malformedStatistic['appended']++;
            } elseif ($headerColumns < $dataColumns && $this->truncateRowsColumns) {
                $data = array_slice($data, 0, $headerColumns);
                $this->malformedStatistic['truncated']++;
            } elseif ($headerColumns != $dataColumns) {
                if ($this->ignoreMalformed) {
                    $this->malformedStatistic['malformed']++;
                    continue;
                }
                throw new Exception("Count mismatch in line {$this->getLineNumber()}, expected: {$headerColumns}, got: {$dataColumns}");
            }

            $set = array_combine($header, $data);
            yield $set;
        }
    }
787527
public function asArray()
    {
        $array = [];
        $properties = (new \ReflectionClass($this))
            ->getProperties(ReflectionProperty::IS_PUBLIC);

        foreach ($properties as $object) {
            $value = $object->getValue($this);
            if (!isset($value)) {
                continue;
            }
            $property = $object->getName();

            if (!empty($this->mappings)
                && isset($this->mappings[$property])) {
                $property = $this->mappings[$property];
            }

            $array[$property] = $value;
        }

        return new \ArrayIterator($array);
    }
940201
private function getPartHeadersIterator()
    {
        if ($this->part instanceof ParentHeaderPart) {
            return $this->part->getRawHeaderIterator();
        } elseif ($this->part->getParent() !== null && $this->part->getParent()->isMime()) {
            return new ArrayIterator([
                [ 'Content-Type', $this->part->getContentType() ],
                [ 'Content-Disposition', $this->part->getContentDisposition() ],
                [ 'Content-Transfer-Encoding', $this->part->getContentTransferEncoding() ]
            ]);
        }
        return new ArrayIterator();
    }
1099121
public function getIterator()
    {
        $iterator   = parent::getIterator();
        $content    = $this->getDependentContent();

        if ( $content )
        {
            $iterator->append( new ArrayIterator( array(
                'rootTitle' => $content->title,
            ) ) );
        }

        return $iterator;
    }
1263927
public function getIterator() {
		if($this->loaded == false) {
			$this->items = $this->getReferences();
			$this->loaded = true;
		}
		foreach($this->items as $i => $item) {
			if(is_array($item)) $this->items[$i] = new ArrayData($item);
		}
		return new ArrayIterator($this->items);
	}
428949
public function getIterator()
    {
        if ($this->offset > 0) {
            $key   = null;
            $index = 0;
            //Skip the first N
            while (false !== ($record = $this->statement->fetch())) {
                if ($key === $record[ $this->pkField ]) {
                    continue;
                }
                $key = $record[ $this->pkField ];
                if ($index++ === $this->offset) {
                    break;
                }
            }
            $current = $record;
        } else {
            $current = $this->statement->fetch();
        }

        $currentKey = $current[ $this->pkField ];

        $fetchedRecordCount = 1;
        do {
            yield $currentKey => $current;

            $current = $this->statement->fetch();
            if (empty($current)) {
                break;
            }
            if ($currentKey !== $current[ $this->pkField ]) {
                $currentKey = $current[ $this->pkField ];
                $fetchedRecordCount++;
            }
        } while ($fetchedRecordCount <= $this->limit);

        $this->statement->closeCursor();
    }
14408
public function getIterator()
    {
        $iteration_result = array();
        if (\is_array($this->nodes)) {
            foreach ($this->nodes as $node) {
                $iteration_result[] = $this->createChildInstance($node);
            }
        }

        return new \ArrayIterator($iteration_result);
    }
562099
protected function _getIterator()
    {
        $data = &$this->_referDataArrayReference();
        foreach ($data as $k => $v) {
            (!array_key_exists($k, $this->__mapedPropObjects))
                ?: $k = $this->__mapedPropObjects[$k];

            yield $k => $v;
        }
    }
1179253
public function getIterator(): \Traversable
    {
        return new MappingIterator(
                $this->connections,
                function($value, $key)
                {
                    return $this->get($key);
                }
        );
    }
1182669
protected function _fix__getIterator()
    {
        $arr = array();
        foreach($this->_getProperties() as $p) {
            if (!$p->isReadable()) continue;

            $val = $this->__get($p->getKey());
            $arr[(string) $p] = $val;
        }

        return new \ArrayIterator($arr);
    }
937543
public function getIterator(): \Traversable
	{
		$options = [];

		foreach ($this->setOptions as $option => $value) {
			$options[$option] = $this->{'get'.ucfirst($option)}();
		}

		return new \ArrayIterator($options);
	}
436215
public function getIterator()
    {
        $iterator = parent::getIterator();

        if ( $this->id )
        {
            $iterator->append( new ArrayIterator( array(
                'seoUri' => $this->getSeoUri(),
            ) ) );
        }

        return $iterator;
    }