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

current() public static method

Retrieves a value being pointed by an array intrinsic enumerator.
The value returned is dereferenced.
public static current ( IPhpEnumerable array ) : PhpValue
array IPhpEnumerable The array which current value to return.
return Pchp.Core.PhpValue
        public static PhpValue current(IPhpEnumerable array)
        {
            if (array == null)
            {
                //PhpException.ReferenceNull("array");
                //return null;
                throw new ArgumentNullException();
            }

            if (array.IntrinsicEnumerator.AtEnd)
                return PhpValue.False;

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