public virtual void __construct(Traversable it, int flags = BYPASS_KEY, int cit_flags = CachingIterator.CATCH_GET_CHILD, int mode = SELF_FIRST)
        {
            if (it is IteratorAggregate ia)
            {
                it = ia.getIterator();
            }

            if (!(it is Iterator))
            {
                PhpException.InvalidArgument(nameof(it));
            }

            _flags = flags;

            var cachingIt = new RecursiveCachingIterator(_ctx, (Iterator)it, cit_flags);

            base.__construct(cachingIt, mode);
        }
Пример #2
0
        protected override void NextImpl()
        {
            var innerIterator = (RecursiveIterator)_iterator;

            if (innerIterator.hasChildren())
            {
                _children = new RecursiveCachingIterator(
                    _ctx,
                    innerIterator.getChildren(),
                    getFlags());
            }
            else
            {
                _children = null;
            }

            base.NextImpl();
        }