protected function collection_to_array($collection)
    {
        if ($collection instanceof self) {
            return $collection->toArray();

        } else if ($collection instanceof \Traversable) {
            return iterator_to_array($collection);

        } else if ($collection instanceof Arrayable) {
            return $collection->toArray();

        } else if ($collection instanceof Jsonable) {
            return json_decode($collection->toJson(), true);

        } else if (is_object($collection) || is_array($collection)) {
            return (array)$collection;

        } else {
            throw new \InvalidArgumentException(sprintf(
                '$collection has type %s, which is not collection-like',
                gettype($collection)
            ));
        }
    }
protected function collection_to_array($collection)
    {
        if ($collection instanceof self) {
            return $collection->toArray();

        } else if ($collection instanceof \Traversable) {
            return iterator_to_array($collection);

        } else if ($collection instanceof Arrayable) {
            return $collection->toArray();

        } else if ($collection instanceof Jsonable) {
            return json_decode($collection->toJson(), true);

        } else if (is_object($collection) || is_array($collection)) {
            return (array)$collection;

        } else {
            throw new \InvalidArgumentException(sprintf(
                '$collection has type %s, which is not collection-like',
                gettype($collection)
            ));
        }
    }
protected function collection_to_array ( $ collection ) { if ( $ collection instanceof self ) { return $ collection -> toArray ( ) ; } else if ( $ collection instanceof \ Traversable ) { return iterator_to_array ( $ collection ) ; } else if ( $ collection instanceof Arrayable ) { return $ collection -> toArray ( ) ; } else if ( $ collection instanceof Jsonable ) { return json_decode ( $ collection -> toJson ( ) , true ) ; } else if ( is_object ( $ collection ) || is_array ( $ collection ) ) { return ( array ) $ collection ; } else { throw new \ InvalidArgumentException ( sprintf ( '$collection has type %s, which is not collection-like' , gettype ( $ collection ) ) ) ; } }
Give me a native PHP array, regardless of what kind of collection-like
structure is given.

@param Map|Traversable|Arrayable|Jsonable|object|array $items
@return array|boolean
@throws \InvalidArgumentException
Give me a native PHP array regardless of what kind of collection - like structure is given .