本文整理匯總了PHP中OpenVBX::_twilioService方法的典型用法代碼示例。如果您正苦於以下問題:PHP OpenVBX::_twilioService方法的具體用法?PHP OpenVBX::_twilioService怎麽用?PHP OpenVBX::_twilioService使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OpenVBX
的用法示例。
在下文中一共展示了OpenVBX::_twilioService方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getAccount
/**
* Get the Twilio Services Account object for communicating with Twilio HQ
*
* Will return the proper account for communications with Twilio.
* This method is sub-account & twilio connect aware
*
* Optional: Pass different Account Sid & Token values to communicate
* with a different Twilio Account
*
* Twilio Connect Aware. Will return the connect account if applicable.
*
* @throws OpenVBXException if invalid parameters are passed in for new object generation
*
* @static
* @param bool/string $twilio_sid Optional - Twilio Account Sid
* @param bool/string $twilio_token Optional - Twilio Account Token
* @param string $api_version - default api version to use
* @return object Services_Twilio_Rest_Account
*/
public static function getAccount($twilio_sid = false, $twilio_token = false, $api_version = '2010-04-01')
{
$ci =& get_instance();
// if sid & token are passed, make sure they're not the same as our master
// values. If they are, make a new object, otherwise use the same internal object
if (!empty($twilio_sid) || !empty($twilio_token)) {
if (!empty($twilio_sid) && !empty($twilio_token)) {
if (empty($ci->twilio_sid) && empty($ci->twilio_token) || $twilio_sid != $ci->twilio_sid && $twilio_token != $ci->twilio_token) {
try {
$_http_opts = self::get_http_opts();
$_http = new Services_Twilio_TinyHttp($_http_opts['host'], $_http_opts['opts']);
$service = new Services_Twilio($twilio_sid, $twilio_token, $api_version, $_http);
return $service->account;
} catch (Exception $e) {
throw new OpenVBXException($e->getMessage());
}
}
} else {
throw new OpenVBXException('Both a Sid & Token are required to get a new Services Object');
}
}
// return standard service object
if (!self::$_twilioService instanceof Services_Twilio) {
try {
$_http_opts = self::get_http_opts();
$_http = new Services_Twilio_TinyHttp($_http_opts['host'], $_http_opts['opts']);
self::$_twilioService = new Services_Twilio($ci->twilio_sid, $ci->twilio_token, $api_version, $_http);
} catch (Exception $e) {
throw new OpenVBXException($e->getMessage());
}
}
return self::$_twilioService->account;
}