public function setAdapter($adapter)
    {
        if (is_string($adapter)) {
            if (!class_exists($adapter, false)) {
                if (false === strpos($adapter, '_')) {
                    $adapter = 'HTTP_Request2_Adapter_' . ucfirst($adapter);
                }
                if (!class_exists($adapter, false)
                    && preg_match('/^HTTP_Request2_Adapter_([a-zA-Z0-9]+)$/', $adapter)
                ) {
                    include_once str_replace('_', DIRECTORY_SEPARATOR, $adapter) . '.php';
                }
                if (!class_exists($adapter, false)) {
                    throw new HTTP_Request2_LogicException(
                        "Class {$adapter} not found",
                        HTTP_Request2_Exception::MISSING_VALUE
                    );
                }
            }
            $adapter = new $adapter;
        }
        if (!$adapter instanceof HTTP_Request2_Adapter) {
            throw new HTTP_Request2_LogicException(
                'Parameter is not a HTTP request adapter',
                HTTP_Request2_Exception::INVALID_ARGUMENT
            );
        }
        $this->adapter = $adapter;

        return $this;
    }
public function setAdapter($adapter)
    {
        if (is_string($adapter)) {
            if (!class_exists($adapter, false)) {
                if (false === strpos($adapter, '_')) {
                    $adapter = 'HTTP_Request2_Adapter_' . ucfirst($adapter);
                }
                if (!class_exists($adapter, false)
                    && preg_match('/^HTTP_Request2_Adapter_([a-zA-Z0-9]+)$/', $adapter)
                ) {
                    include_once str_replace('_', DIRECTORY_SEPARATOR, $adapter) . '.php';
                }
                if (!class_exists($adapter, false)) {
                    throw new HTTP_Request2_LogicException(
                        "Class {$adapter} not found",
                        HTTP_Request2_Exception::MISSING_VALUE
                    );
                }
            }
            $adapter = new $adapter;
        }
        if (!$adapter instanceof HTTP_Request2_Adapter) {
            throw new HTTP_Request2_LogicException(
                'Parameter is not a HTTP request adapter',
                HTTP_Request2_Exception::INVALID_ARGUMENT
            );
        }
        $this->adapter = $adapter;

        return $this;
    }
public function setAdapter ( $ adapter ) { if ( is_string ( $ adapter ) ) { if ( ! class_exists ( $ adapter , false ) ) { if ( false === strpos ( $ adapter , '_' ) ) { $ adapter = 'HTTP_Request2_Adapter_' . ucfirst ( $ adapter ) ; } if ( ! class_exists ( $ adapter , false ) && preg_match ( '/^HTTP_Request2_Adapter_([a-zA-Z0-9]+)$/' , $ adapter ) ) { include_once str_replace ( '_' , DIRECTORY_SEPARATOR , $ adapter ) . '.php' ; } if ( ! class_exists ( $ adapter , false ) ) { throw new HTTP_Request2_LogicException ( "Class {$adapter} not found" , HTTP_Request2_Exception :: MISSING_VALUE ) ; } } $ adapter = new $ adapter ; } if ( ! $ adapter instanceof HTTP_Request2_Adapter ) { throw new HTTP_Request2_LogicException ( 'Parameter is not a HTTP request adapter' , HTTP_Request2_Exception :: INVALID_ARGUMENT ) ; } $ this -> adapter = $ adapter ; return $ this ; }
Sets the adapter used to actually perform the request

You can pass either an instance of a class implementing HTTP_Request2_Adapter
or a class name. The method will only try to include a file if the class
name starts with HTTP_Request2_Adapter_, it will also try to prepend this
prefix to the class name if it doesn't contain any underscores, so that
<code>
$request->setAdapter('curl');
</code>
will work.

@param string|HTTP_Request2_Adapter $adapter Adapter to use

@return   HTTP_Request2
@throws   HTTP_Request2_LogicException
Sets the adapter used to actually perform the request