@@ -24,24 +24,24 @@ public function __construct($api_response)
2424 */
2525 public static function getError ($ status_code , $ error_type )
2626 {
27- switch ($ status_code ) {
28- case 401 :
29- return 'AuthenticationException ' ;
30- case 403 :
31- return 'PermissionsException ' ;
32- case 429 :
33- return 'RateLimitException ' ;
27+ switch ($ status_code ) {
28+ case 401 :
29+ return 'AuthenticationException ' ;
30+ case 403 :
31+ return 'PermissionsException ' ;
32+ case 429 :
33+ return 'RateLimitException ' ;
3434 }
3535
36- switch ($ error_type ) {
37- case 'gocardless ' :
38- return 'GoCardlessInternalException ' ;
39- case 'invalid_api_usage ' :
40- return 'InvalidApiUsageException ' ;
41- case 'invalid_state ' :
42- return 'InvalidStateException ' ;
43- case 'validation_failed ' :
44- return 'ValidationFailedException ' ;
36+ switch ($ error_type ) {
37+ case 'gocardless ' :
38+ return 'GoCardlessInternalException ' ;
39+ case 'invalid_api_usage ' :
40+ return 'InvalidApiUsageException ' ;
41+ case 'invalid_state ' :
42+ return 'InvalidStateException ' ;
43+ case 'validation_failed ' :
44+ return 'ValidationFailedException ' ;
4545 }
4646
4747 throw new GoCardlessProException ('Invalid error type ' . $ error_type );
@@ -55,7 +55,7 @@ public function getType()
5555 public function getErrors ()
5656 {
5757 if (property_exists ($ this ->api_error , 'errors ' )) {
58- return $ this ->api_error ->errors ;
58+ return $ this ->api_error ->errors ;
5959 }
6060
6161 return array ();
@@ -79,21 +79,21 @@ public function getApiResponse()
7979 protected function getErrorMessage ()
8080 {
8181 if (!is_array ($ this ->getErrors ())) {
82- return $ this ->api_error ->message ;
82+ return $ this ->api_error ->message ;
8383 }
8484
8585 $ error_messages = array_map (array ($ this , 'extractErrorMessage ' ), $ this ->getErrors ());
8686 $ error_messages = array_filter (
8787 $ error_messages ,
8888 function ($ m ) {
89- return $ m != $ this ->api_error ->message ;
89+ return $ m != $ this ->api_error ->message ;
9090 }
9191 );
9292
9393 if (count ($ error_messages ) > 0 ) {
94- return $ this ->api_error ->message . ' ( ' . implode (", " , $ error_messages ) . ') ' ;
94+ return $ this ->api_error ->message . ' ( ' . implode (", " , $ error_messages ) . ') ' ;
9595 } else {
96- return $ this ->api_error ->message ;
96+ return $ this ->api_error ->message ;
9797 }
9898 }
9999
0 commit comments