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

end() public static method

Moves array intrinsic enumerator so it will point to the last item of the array.
The value returned is dereferenced.
public static end ( IPhpEnumerable array ) : PhpValue
array IPhpEnumerable The array which intrinsic enumerator to move.
return Pchp.Core.PhpValue
        public static PhpValue end(IPhpEnumerable array)
        {
            if (array == null)
            {
                //PhpException.ReferenceNull("array");
                //return null;
                throw new ArgumentNullException();
            }

            // moves to the last item and returns false if there is no such item:
            // TODO: dereferences result since enumerator doesn't do so:
            return (array.IntrinsicEnumerator.MoveLast())
                ? array.IntrinsicEnumerator.CurrentValue
                : PhpValue.False;
        }