public function setAuth($user, $password = '', $type = self::AUTH_BASIC)
{
// If we got false or null, disable authentication
if ($user === false || $user === null) {
$this->auth = null;
// Clear the auth information in the uri instance as well
if ($this->uri instanceof Zend_Uri_Http) {
$this->getUri()->setUsername('');
$this->getUri()->setPassword('');
}
// Else, set up authentication
} else {
// Check we got a proper authentication type
if (!defined('self::AUTH_' . strtoupper($type))) {
/** @see Zend_Http_Client_Exception */
require_once 'Zend/Http/Client/Exception.php';
throw new Zend_Http_Client_Exception("Invalid or not supported authentication type: '{$type}'");
}
$this->auth = array('user' => (string) $user, 'password' => (string) $password, 'type' => $type);
}
return $this;
}