{@inheritdoc}

@return \Traversable
353604
public function all()
    {
        $query = $this->model->newQuery()
                             ->select($this->model->getTable().'.*')
                             ->orderBy($this->model->getNameKey())
                             ->distinct();

        if ($this->resourceName) {
            $query->join($this->relationTable, $this->tagKeyName(), '=', $this->model->getTable().'.'.$this->model->getKeyName());
            $query->where($this->resourceNameKey, $this->resourceName);
        }

        return $query->get();
    }
420511
protected function getCursor(): Traversable
    {
        if (!$this->cursor) {
            $driverCursor = $this->collection->{$this->command}(...$this->params);
            $this->cursor = new IteratorIterator($driverCursor);
            $this->cursor->rewind();
        }

        return $this->cursor;
    }
1030655
public function findReferencedNodes(): TraversableNodes
    {
        $referencedNodes = [];
        foreach ($this->getNodeType()->getProperties() as $propertyName => $property) {
            $propertyType = $this->getNodeType()->getPropertyType($propertyName);
            if ($propertyType === 'reference' && $this->getProperty($propertyName) instanceof TraversableNodeInterface) {
                $referencedNodes[] = $this->getProperty($propertyName);
            } elseif ($propertyName === 'references' && !empty($this->getProperty($propertyName))) {
                foreach ($this->getProperty($propertyName) as $node) {
                    if ($node instanceof TraversableNodeInterface) {
                        $referencedNodes[] = $node;
                    }
                }
            }
        }

        return TraversableNodes::fromArray($referencedNodes);
    }
1065126
public static function fromTraversable(Traversable $data): self
    {
        $map = new static();

        foreach ($data as $key => $val) {
            if (!is_scalar($key)) {
                throw new InvalidArgumentException('Map keys must be scalar');
            }

            $map->decorated->offsetSet($key, $val);
        }

        return $map;
    }
387549
public function next(TraversableNodeInterface $referenceNode): TraversableNodeInterface
    {
        $referenceNodeIndex = $this->getNodeIndex($referenceNode);
        if ($referenceNodeIndex === $this->count() - 1) {
            throw new \InvalidArgumentException(sprintf('The node %s is the last node in the set, so there is no next node.', $referenceNode->getNodeAggregateIdentifier()), 1542902858);
        }
        return $this->nodes[$referenceNodeIndex + 1];
    }
1244751
public function previous(TraversableNodeInterface $referenceNode): TraversableNodeInterface
    {
        $referenceNodeIndex = $this->getNodeIndex($referenceNode);
        if ($referenceNodeIndex === 0) {
            throw new \InvalidArgumentException(sprintf('The node %s is the first node in the set, so there is no previous node.', $referenceNode->getNodeAggregateIdentifier()), 1542902422);
        }
        return $this->nodes[$referenceNodeIndex - 1];
    }
985020
public function getChildrenRecursive()
    {
        $res = new ObjectCollection();
        foreach ($this->children() as $child) {
            $res->add($child);
            if ($child instanceof ParentNodeInterface) {
                $res->addMany($child->getChildrenRecursive());
            }
        }

        return $res;
    }
1207762
public function visitTraversableType(TraversableType $type)
    {
        $difference = $this->comparePrimaryType($type);

        if (0 !== $difference) {
            return $difference;
        }

        $difference = $this->comparator
            ->compare($this->type->primaryType(), $type->primaryType());

        if (0 !== $difference) {
            return $difference;
        }

        $leftKeyType = $this->type->keyType();
        $rightKeyType = $type->keyType();

        if ($leftKeyType) {
            if ($rightKeyType) {
                $difference =
                    $this->comparator->compare($leftKeyType, $rightKeyType);

                if (0 !== $difference) {
                    return $difference;
                }
            } else {
                return 1;
            }
        } elseif ($rightKeyType) {
            return -1;
        }

        return $this->comparator
            ->compare($this->type->valueType(), $type->valueType());
    }
1110126
protected function iteratoToArray(Traversable $config) {
		$config = iterator_to_array($config);
		
		foreach ($config as &$value) {
			if ($value instanceof Traversable) {
				$value = $this->iteratoToArray($value);
			}
		}
		unset($value);
		
		return $config;
	}
34517
protected function popsCreateInnerIterator()
    {
        if ($this->popsValue() instanceof Iterator) {
            $iterator = $this->popsValue();
        } elseif ($this->popsValue() instanceof IteratorAggregate) {
            $iterator = $this->popsValue()->getIterator();
        } else {
            throw new LogicException(
                'Proxied object is not an instance of Traversable'
            );
        }

        return $iterator;
    }
716261
protected function loadResource($resources, $parent = null)
    {
        if (!is_array($resources) && !($resources instanceof \Traversable)) {
            throw new \InvalidArgumentException('Resources argument must be traversable: ' . print_r($resources, true));
        }

        foreach ($resources as $key => $value) {
            if ($value instanceof ResourceInterface) {
                $key = $value;
            } elseif (is_string($key)) {
                $key = new GenericResource($key);
            } elseif (is_int($key)) {
                $key = new GenericResource($value);
            }

            if (is_array($value) || ($value instanceof \Traversable)) {
                $this->acl->addResource($key, $parent);
                $this->loadResource($value, $key);
            } elseif (!$this->acl->hasResource($key)) {
                $this->acl->addResource($key, $parent);
            }
        }
    }
1002697
public function traverse(callable $visitor)
    {
        if ($this->_query) {
            return;
        }

        if (!$this->_castedExpressions) {
            $this->_processExpressions();
        }

        foreach ($this->_values as $v) {
            if ($v instanceof ExpressionInterface) {
                $v->traverse($visitor);
            }
            if (!is_array($v)) {
                continue;
            }
            foreach ($v as $column => $field) {
                if ($field instanceof ExpressionInterface) {
                    $visitor($field);
                    $field->traverse($visitor);
                }
            }
        }
    }
771336
public function getIterator(): Traversable
    {
        foreach ($this->values as $index => &$value) {
            yield $this->keys[$index] => $value;
        }
    }
1280695
protected function getProperties(string $resourceClass): \Traversable
    {
        if (null !== $this->properties) {
            return yield from array_keys($this->properties);
        }

        try {
            yield from $this->propertyNameCollectionFactory->create($resourceClass);
        } catch (ResourceClassNotFoundException $e) {
        }
    }
996848
public function options($options = [])
    {
        if (!$this->keyAsValue) {
            return parent::options($options);
        }

        if ($options instanceof Collection) {
            $options = $options->pluck($this->visibleColumn, $this->key)->toArray();
        }

        if ($options instanceof Arrayable) {
            $options = $options->toArray();
        }

        $this->options = $options + $this->options;

        return $this;
    }
303897
public static function isTraversable($value)
    {
        return is_array($value) || (is_object($value) &&  (get_class($value) == 'stdClass' || $value instanceof \Traversable));
    }
609075
public static function keys($value)
    {

        if (is_array($value)) {
            return array_keys($value);
        }

        if (!is_object($value)) {
            return [];
        }

        if (!$value instanceof Traversable) {
            return array_keys(get_object_vars($value));
        }

        return array_keys(iterator_to_array($value, true));

    }