Medusa\Tree\PersistentAvlTree::getIterator PHP Метод

getIterator() публичный Метод

public getIterator ( )
    public function getIterator()
    {
        $stack = PersistentStack::createEmpty();
        for ($current = $this; !$current->isEmpty() || !$stack->isEmpty(); $current = $current->right()) {
            while (!$current->isEmpty()) {
                $stack = $stack->push($current);
                $current = $current->left();
            }
            $current = $stack->peek();
            $stack = $stack->pop();
            (yield $current->key() => $current->value());
        }
    }