original_string: 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)
              ));
          }
      }
code: 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)
              ));
          }
      }
code_tokens: 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 ) ) ) ; } }
docstring: 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
docstring_tokens: Give me a native PHP array regardless of what kind of collection - like structure is given .