本文整理匯總了PHP中PEAR_Error::isError方法的典型用法代碼示例。如果您正苦於以下問題:PHP PEAR_Error::isError方法的具體用法?PHP PEAR_Error::isError怎麽用?PHP PEAR_Error::isError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PEAR_Error
的用法示例。
在下文中一共展示了PEAR_Error::isError方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: switch
/**
* Handles the authentication using any known method.
*
* @param string $uid The userid to authenticate as.
* @param string $pwd The password to authenticate with.
* @param string $userMethod The method to use. If empty, the class chooses
* the best (strongest) available method.
* @param string $euser The effective uid to authenticate as.
*
* @return void
*/
function _cmdAuthenticate($uid, $pwd, $userMethod = null, $euser = '')
{
$method = $this->_getBestAuthMethod($userMethod);
if (is_a($method, 'PEAR_Error')) {
return $method;
}
switch ($method) {
case 'DIGEST-MD5':
return $this->_authDigestMD5($uid, $pwd, $euser);
case 'CRAM-MD5':
$result = $this->_authCRAMMD5($uid, $pwd, $euser);
break;
case 'LOGIN':
$result = $this->_authLOGIN($uid, $pwd, $euser);
break;
case 'PLAIN':
$result = $this->_authPLAIN($uid, $pwd, $euser);
break;
case 'EXTERNAL':
$result = $this->_authEXTERNAL($uid, $pwd, $euser);
break;
default:
$result = $this->_pear->raiseError($method . ' is not a supported authentication method');
break;
}
$res = $this->_doCmd();
if (is_a($res, 'PEAR_Error')) {
return $res;
}
// Query the server capabilities again now that we are authenticated.
if ($this->_pear->isError($res = $this->_cmdCapability())) {
return $this->_pear->raiseError('Failed to connect, server said: ' . $res->getMessage(), 2);
}
return $result;
}