예제 #1
0
        internal protected void rewindImpl()
        {
            if (_iterator != null)
            {
                // we can make use of standard foreach enumerator
                _enumerator = Operators.GetForeachEnumerator(_iterator, true, default(RuntimeTypeHandle));

                //
                _valid = _enumerator.MoveNext();
            }
        }
예제 #2
0
        public virtual void next()
        {
            // init iterator first (this skips the first element as on PHP)
            if (_enumerator == null)
            {
                rewind();
            }

            // enumerator can be still null, if iterator is null
            _valid = _enumerator != null && _enumerator.MoveNext();
        }
예제 #3
0
        public virtual void rewind()
        {
            if (_iterator != null)
            {
                // we can make use of standard foreach enumerator
                _enumerator = Operators.GetForeachEnumerator(_iterator, true, default(RuntimeTypeHandle));

                //
                _valid = _enumerator.MoveNext();
            }
        }
예제 #4
0
        /// <summary>
        /// Creates array from PHP enumerator.
        /// </summary>
        internal static PhpArray Create(IPhpEnumerator phpenumerator)
        {
            Debug.Assert(phpenumerator != null);

            var arr = new PhpArray();

            while (phpenumerator.MoveNext())
            {
                var current = phpenumerator.Current;
                arr.Add(current.Key.ToIntStringKey(), current.Value);
            }

            //
            return(arr);
        }