src/Crate/Stdlib/ArrayUtils.php
public static function toArray($value)
    {
        if (is_array($value)) {
            return $value;
        }

        if ($value === null) {
            return [];
        }

        if (!$value instanceof Traversable) {
            throw new Exception\InvalidArgumentException(
                'An invalid value was provided, should either be an null, array or Traversable'
            );
        }

        return iterator_to_array($value);
    }
public static function toArray($value)
    {
        if (is_array($value)) {
            return $value;
        }

        if ($value === null) {
            return [];
        }

        if (!$value instanceof Traversable) {
            throw new Exception\InvalidArgumentException(
                'An invalid value was provided, should either be an null, array or Traversable'
            );
        }

        return iterator_to_array($value);
    }
public static function toArray ( $ value ) { if ( is_array ( $ value ) ) { return $ value ; } if ( $ value === null ) { return [ ] ; } if ( ! $ value instanceof Traversable ) { throw new Exception \ InvalidArgumentException ( 'An invalid value was provided, should either be an null, array or Traversable' ) ; } return iterator_to_array ( $ value ) ; }
Convert a optional value that when used is expected to be an array

@param mixed $value

@throws Exception\InvalidArgumentException

@return array
Convert a optional value that when used is expected to be an array