original_string: public function createAdapter($collection)
      {
          if (\is_array($collection)) {
              $className = 'Array';
          } else {
              try {
                  $r = new \ReflectionClass($collection);
                  $className = $r->getName();
              } catch (\ReflectionException $exc) {
                  throw new AdapterNotSupportedException($collection);
              }
          }
  
          $adapterName =
              __NAMESPACE__ . "\\" . $className . 'Adapter'
          ;
  
          return new $adapterName($collection);
      }
code: public function createAdapter($collection)
      {
          if (\is_array($collection)) {
              $className = 'Array';
          } else {
              try {
                  $r = new \ReflectionClass($collection);
                  $className = $r->getName();
              } catch (\ReflectionException $exc) {
                  throw new AdapterNotSupportedException($collection);
              }
          }
  
          $adapterName =
              __NAMESPACE__ . "\\" . $className . 'Adapter'
          ;
  
          return new $adapterName($collection);
      }
code_tokens: public function createAdapter ( $ collection ) { if ( \ is_array ( $ collection ) ) { $ className = 'Array' ; } else { try { $ r = new \ ReflectionClass ( $ collection ) ; $ className = $ r -> getName ( ) ; } catch ( \ ReflectionException $ exc ) { throw new AdapterNotSupportedException ( $ collection ) ; } } $ adapterName = __NAMESPACE__ . "\\" . $ className . 'Adapter' ; return new $ adapterName ( $ collection ) ; }
docstring: This method recieve a data collection and returns the corresponding adapter.
  
  @param mixed $collection
  @return AdapterInterface
  @throws Ideup\SimplePaginatorBundle\Paginator\Exception\AdapterNotSupportedException
docstring_tokens: This method recieve a data collection and returns the corresponding adapter .