@@ -241,7 +241,7 @@ public function __call($fn, $params)
241
241
for ($ i = 0 ; $ i < 26 ; $ i ++) {
242
242
$ method_template = str_replace (chr (65 + $ i ), '_ ' . chr (97 + $ i ), $ method_template );
243
243
}
244
- throw new Exception (
244
+ throw new \ Exception (
245
245
'To call the templated method " ' . $ method_template
246
246
. '", specify the parameter value for " ' . $ param_l . '". '
247
247
);
@@ -285,7 +285,7 @@ public function __call($fn, $params)
285
285
public function oauth_authenticate ($ force_login = NULL , $ screen_name = NULL )
286
286
{
287
287
if ($ this ->_oauth_token == null ) {
288
- throw new Exception ('To get the authenticate URL, the OAuth token must be set. ' );
288
+ throw new \ Exception ('To get the authenticate URL, the OAuth token must be set. ' );
289
289
}
290
290
$ url = self ::$ _endpoint_oauth . 'oauth/authenticate?oauth_token= ' . $ this ->_url ($ this ->_oauth_token );
291
291
if ($ force_login ) {
@@ -305,7 +305,7 @@ public function oauth_authenticate($force_login = NULL, $screen_name = NULL)
305
305
public function oauth_authorize ($ force_login = NULL , $ screen_name = NULL )
306
306
{
307
307
if ($ this ->_oauth_token == null ) {
308
- throw new Exception ('To get the authorize URL, the OAuth token must be set. ' );
308
+ throw new \ Exception ('To get the authorize URL, the OAuth token must be set. ' );
309
309
}
310
310
$ url = self ::$ _endpoint_oauth . 'oauth/authorize?oauth_token= ' . $ this ->_url ($ this ->_oauth_token );
311
311
if ($ force_login ) {
@@ -326,10 +326,10 @@ public function oauth_authorize($force_login = NULL, $screen_name = NULL)
326
326
public function oauth2_token ()
327
327
{
328
328
if (! function_exists ('curl_init ' )) {
329
- throw new Exception ('To make API requests, the PHP curl extension must be available. ' );
329
+ throw new \ Exception ('To make API requests, the PHP curl extension must be available. ' );
330
330
}
331
331
if (self ::$ _oauth_consumer_key == null ) {
332
- throw new Exception ('To obtain a bearer token, the consumer key must be set. ' );
332
+ throw new \ Exception ('To obtain a bearer token, the consumer key must be set. ' );
333
333
}
334
334
$ ch = false ;
335
335
$ post_fields = array (
@@ -414,10 +414,10 @@ private function _url($data)
414
414
private function _sha1 ($ data )
415
415
{
416
416
if (self ::$ _oauth_consumer_secret == null ) {
417
- throw new Exception ('To generate a hash, the consumer secret must be set. ' );
417
+ throw new \ Exception ('To generate a hash, the consumer secret must be set. ' );
418
418
}
419
419
if (!function_exists ('hash_hmac ' )) {
420
- throw new Exception ('To generate a hash, the PHP hash extension must be available. ' );
420
+ throw new \ Exception ('To generate a hash, the PHP hash extension must be available. ' );
421
421
}
422
422
return base64_encode (hash_hmac ('sha1 ' , $ data , self ::$ _oauth_consumer_secret . '& '
423
423
. ($ this ->_oauth_token_secret != null ? $ this ->_oauth_token_secret : '' ), true ));
@@ -433,7 +433,7 @@ private function _sha1($data)
433
433
protected function _nonce ($ length = 8 )
434
434
{
435
435
if ($ length < 1 ) {
436
- throw new Exception ('Invalid nonce length. ' );
436
+ throw new \ Exception ('Invalid nonce length. ' );
437
437
}
438
438
return substr (md5 (microtime (true )), 0 , $ length );
439
439
}
@@ -450,7 +450,7 @@ protected function _nonce($length = 8)
450
450
protected function _sign ($ httpmethod , $ method , $ params = array ())
451
451
{
452
452
if (self ::$ _oauth_consumer_key == null ) {
453
- throw new Exception ('To generate a signature, the consumer key must be set. ' );
453
+ throw new \ Exception ('To generate a signature, the consumer key must be set. ' );
454
454
}
455
455
$ sign_params = array (
456
456
'consumer_key ' => self ::$ _oauth_consumer_key ,
@@ -659,7 +659,7 @@ protected function _detectMethod($method, $params)
659
659
return $ httpmethod ;
660
660
}
661
661
}
662
- throw new Exception ('Can \'t find HTTP method to use for " ' . $ method . '". ' );
662
+ throw new \ Exception ('Can \'t find HTTP method to use for " ' . $ method . '". ' );
663
663
}
664
664
665
665
/**
@@ -721,7 +721,7 @@ protected function _detectFilenames($method, &$params)
721
721
}
722
722
// is it an array?
723
723
if (is_array ($ params [$ possible_file ])) {
724
- throw new Exception ('Using URL-encoded parameters is not supported for uploading media. ' );
724
+ throw new \ Exception ('Using URL-encoded parameters is not supported for uploading media. ' );
725
725
continue ;
726
726
}
727
727
// is it a file, a readable one?
@@ -785,7 +785,7 @@ protected function _getEndpoint($method, $method_template)
785
785
protected function _callApi ($ httpmethod , $ method , $ method_template , $ params = array (), $ multipart = false , $ app_only_auth = false )
786
786
{
787
787
if (! function_exists ('curl_init ' )) {
788
- throw new Exception ('To make API requests, the PHP curl extension must be available. ' );
788
+ throw new \ Exception ('To make API requests, the PHP curl extension must be available. ' );
789
789
}
790
790
$ url = $ this ->_getEndpoint ($ method , $ method_template );
791
791
$ ch = false ;
@@ -809,7 +809,7 @@ protected function _callApi($httpmethod, $method, $method_template, $params = ar
809
809
}
810
810
if ($ app_only_auth ) {
811
811
if (self ::$ _oauth_consumer_key == null ) {
812
- throw new Exception ('To make an app-only auth API request, the consumer key must be set. ' );
812
+ throw new \ Exception ('To make an app-only auth API request, the consumer key must be set. ' );
813
813
}
814
814
// automatically fetch bearer token, if necessary
815
815
if (self ::$ _oauth_bearer_token == null ) {
0 commit comments