original_string: public function setAdapter($adapter)
      {
          if (!is_string($adapter) && !$adapter instanceof ConversionAlgorithmInterface) {
              throw new Exception\InvalidArgumentException(sprintf(
                  '"%s" expects a string or an instance of ConversionAlgorithmInterface; received "%s"',
                  __METHOD__,
                  is_object($adapter) ? get_class($adapter) : gettype($adapter)
              ));
          }
          if (is_string($adapter)) {
              if (!class_exists($adapter)) {
                  throw new Exception\RuntimeException(sprintf(
                      '"%s" unable to load adapter; class "%s" not found',
                      __METHOD__,
                      $adapter
                  ));
              }
              $adapter = new $adapter();
              if (!$adapter instanceof ConversionAlgorithmInterface) {
                  throw new Exception\InvalidArgumentException(sprintf(
                      '"%s" expects a string representing an instance of ConversionAlgorithmInterface; received "%s"',
                      __METHOD__,
                      is_object($adapter) ? get_class($adapter) : gettype($adapter)
                  ));
              }
          }
          $this->adapter = $adapter;
  
          return $this;
      }
code: public function setAdapter($adapter)
      {
          if (!is_string($adapter) && !$adapter instanceof ConversionAlgorithmInterface) {
              throw new Exception\InvalidArgumentException(sprintf(
                  '"%s" expects a string or an instance of ConversionAlgorithmInterface; received "%s"',
                  __METHOD__,
                  is_object($adapter) ? get_class($adapter) : gettype($adapter)
              ));
          }
          if (is_string($adapter)) {
              if (!class_exists($adapter)) {
                  throw new Exception\RuntimeException(sprintf(
                      '"%s" unable to load adapter; class "%s" not found',
                      __METHOD__,
                      $adapter
                  ));
              }
              $adapter = new $adapter();
              if (!$adapter instanceof ConversionAlgorithmInterface) {
                  throw new Exception\InvalidArgumentException(sprintf(
                      '"%s" expects a string representing an instance of ConversionAlgorithmInterface; received "%s"',
                      __METHOD__,
                      is_object($adapter) ? get_class($adapter) : gettype($adapter)
                  ));
              }
          }
          $this->adapter = $adapter;
  
          return $this;
      }
code_tokens: public function setAdapter ( $ adapter ) { if ( ! is_string ( $ adapter ) && ! $ adapter instanceof ConversionAlgorithmInterface ) { throw new Exception \ InvalidArgumentException ( sprintf ( '"%s" expects a string or an instance of ConversionAlgorithmInterface; received "%s"' , __METHOD__ , is_object ( $ adapter ) ? get_class ( $ adapter ) : gettype ( $ adapter ) ) ) ; } if ( is_string ( $ adapter ) ) { if ( ! class_exists ( $ adapter ) ) { throw new Exception \ RuntimeException ( sprintf ( '"%s" unable to load adapter; class "%s" not found' , __METHOD__ , $ adapter ) ) ; } $ adapter = new $ adapter ( ) ; if ( ! $ adapter instanceof ConversionAlgorithmInterface ) { throw new Exception \ InvalidArgumentException ( sprintf ( '"%s" expects a string representing an instance of ConversionAlgorithmInterface; received "%s"' , __METHOD__ , is_object ( $ adapter ) ? get_class ( $ adapter ) : gettype ( $ adapter ) ) ) ; } } $ this -> adapter = $ adapter ; return $ this ; }
docstring: Sets conversion adapter
  
  @param  string|ConversionAlgorithmInterface $adapter Adapter to use
  @return $this
  @throws Exception\InvalidArgumentException
  @throws Exception\RuntimeException
docstring_tokens: Sets conversion adapter