public function login($user = null, $password = null, $authmethod = null, $euser = null)
{
if (isset($user)) {
$this->_params['user'] = $user;
}
if (isset($password)) {
$this->_params['password'] = $password;
}
if (isset($authmethod)) {
$this->_params['authmethod'] = $authmethod;
}
if (isset($euser)) {
$this->_params['euser'] = $euser;
}
$this->_checkConnected();
if (self::STATE_AUTHENTICATED == $this->_state) {
throw new Exception('Already authenticated');
}
$this->_cmdAuthenticate($this->_params['user'], $this->_params['password'], $this->_params['authmethod'], $this->_params['euser']);
$this->_state = self::STATE_AUTHENTICATED;
}