public function setAdapter($adapter)
{
if (is_string($adapter)) {
try {
Zend_Loader::loadClass($adapter);
} catch (Zend_Exception $e) {
/** @see Zend_Http_Client_Exception */
require_once 'Zend/Http/Client/Exception.php';
throw new Zend_Http_Client_Exception("Unable to load adapter '{$adapter}': {$e->getMessage()}", 0, $e);
}
$adapter = new $adapter();
}
if (!$adapter instanceof Zend_Http_Client_Adapter_Interface) {
/** @see Zend_Http_Client_Exception */
require_once 'Zend/Http/Client/Exception.php';
throw new Zend_Http_Client_Exception('Passed adapter is not a HTTP connection adapter');
}
$this->adapter = $adapter;
$config = $this->config;
unset($config['adapter']);
$this->adapter->setConfig($config);
}