Pchp.Library.Arrays.next C# (CSharp) Method

next() public static method

Advances array intrinsic enumerator one item forward.
The value returned is dereferenced.
public static next ( IPhpEnumerable array ) : PhpValue
array IPhpEnumerable The array which intrinsic enumerator to advance.
return Pchp.Core.PhpValue
        public static PhpValue next(IPhpEnumerable array)
        {
            if (array == null)
            {
                //PhpException.ReferenceNull("array");
                //return null;
                throw new ArgumentNullException();
            }

            // moves to the next item and returns false if there is no such item:
            if (!array.IntrinsicEnumerator.MoveNext()) return PhpValue.False;

            // TODO: dereferences result since enumerator doesn't do so:
            return array.IntrinsicEnumerator.CurrentValue;
        }