@@ -133,6 +133,7 @@ |
||
| 133 | 133 | |
| 134 | 134 | /** |
| 135 | 135 | * @inheritdoc |
| 136 | + * @param string $body |
|
| 136 | 137 | */ |
| 137 | 138 | public function setBody($body) { |
| 138 | 139 | $this->body = $body; |
@@ -90,7 +90,7 @@ |
||
| 90 | 90 | /** |
| 91 | 91 | * Always make sure to destroy Curl Resource |
| 92 | 92 | */ |
| 93 | - public function __destruct() { |
|
| 93 | + public function __destruct(){ |
|
| 94 | 94 | if ($this->status!==self::STATUS_CLOSED){ |
| 95 | 95 | curl_close($this->CurlRequest); |
| 96 | 96 | } |
@@ -90,7 +90,7 @@ |
||
| 90 | 90 | /** |
| 91 | 91 | * Always make sure to destroy Curl Resource |
| 92 | 92 | */ |
| 93 | - public function __destruct() { |
|
| 93 | + public function __destruct(){ |
|
| 94 | 94 | if ($this->status!==self::STATUS_CLOSED){ |
| 95 | 95 | curl_close($this->CurlRequest); |
| 96 | 96 | } |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | class EntryPointException extends SDKException { |
| 6 | 6 | |
| 7 | - public function __construct($message) { |
|
| 7 | + public function __construct($message){ |
|
| 8 | 8 | parent::__construct($message); |
| 9 | 9 | } |
| 10 | 10 | |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | class EntryPointException extends SDKException { |
| 6 | 6 | |
| 7 | - public function __construct($message) { |
|
| 7 | + public function __construct($message){ |
|
| 8 | 8 | parent::__construct($message); |
| 9 | 9 | } |
| 10 | 10 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @param $EntryPoint - EPInterface Class Name |
| 32 | 32 | * @return $this |
| 33 | 33 | */ |
| 34 | - public function registerEntryPoint($function,$EntryPoint); |
|
| 34 | + public function registerEntryPoint($function, $EntryPoint); |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * Login to the configured SugarCRM server |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * @param $client_id |
| 58 | 58 | * @return boolean |
| 59 | 59 | */ |
| 60 | - public static function storeToken($token,$client_id); |
|
| 60 | + public static function storeToken($token, $client_id); |
|
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * Get an SDK Clients authentication Token from Storage |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | public static function getSDKEntryPointRegistry(){ |
| 40 | 40 | $entryPoints = array(); |
| 41 | 41 | require __DIR__.DIRECTORY_SEPARATOR.'registry.php'; |
| 42 | - foreach ($entryPoints as $funcName => $className) { |
|
| 42 | + foreach ($entryPoints as $funcName => $className){ |
|
| 43 | 43 | $className = "SugarAPI\\SDK\\EntryPoint\\" . $className; |
| 44 | 44 | $entryPoints[$funcName] = $className; |
| 45 | 45 | } |
@@ -15,10 +15,10 @@ discard block |
||
| 15 | 15 | * @return string |
| 16 | 16 | */ |
| 17 | 17 | public static function configureAPIURL($instance){ |
| 18 | - if (strpos($instance,"http")===FALSE){ |
|
| 18 | + if (strpos($instance, "http")===FALSE){ |
|
| 19 | 19 | $instance = "http://".$instance; |
| 20 | 20 | } |
| 21 | - if (strpos($instance,"rest/v10")!==FALSE){ |
|
| 21 | + if (strpos($instance, "rest/v10")!==FALSE){ |
|
| 22 | 22 | $instance = str_replace("rest/v10", "", $instance); |
| 23 | 23 | } |
| 24 | 24 | return rtrim($instance, "/").self::API_URL; |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | public static function getSDKEntryPointRegistry(){ |
| 40 | 40 | $entryPoints = array(); |
| 41 | 41 | require __DIR__.DIRECTORY_SEPARATOR.'registry.php'; |
| 42 | - foreach ($entryPoints as $funcName => $className) { |
|
| 43 | - $className = "SugarAPI\\SDK\\EntryPoint\\" . $className; |
|
| 42 | + foreach ($entryPoints as $funcName => $className){ |
|
| 43 | + $className = "SugarAPI\\SDK\\EntryPoint\\".$className; |
|
| 44 | 44 | $entryPoints[$funcName] = $className; |
| 45 | 45 | } |
| 46 | 46 | return $entryPoints; |
@@ -8,14 +8,14 @@ |
||
| 8 | 8 | |
| 9 | 9 | abstract class AbstractPostFileEntryPoint extends AbstractEntryPoint { |
| 10 | 10 | |
| 11 | - public function __construct($url, array $options = array()) { |
|
| 11 | + public function __construct($url, array $options = array()){ |
|
| 12 | 12 | $this->setRequest(new POSTFile()); |
| 13 | 13 | parent::__construct($url, $options); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - public function execute($data = null) { |
|
| 16 | + public function execute($data = null){ |
|
| 17 | 17 | parent::execute($data); |
| 18 | - $this->setResponse(new JSON($this->Request->getResponse(),$this->Request->getCurlObject())); |
|
| 18 | + $this->setResponse(new JSON($this->Request->getResponse(), $this->Request->getCurlObject())); |
|
| 19 | 19 | return $this; |
| 20 | 20 | } |
| 21 | 21 | |
@@ -8,12 +8,12 @@ |
||
| 8 | 8 | |
| 9 | 9 | abstract class AbstractPostFileEntryPoint extends AbstractEntryPoint { |
| 10 | 10 | |
| 11 | - public function __construct($url, array $options = array()) { |
|
| 11 | + public function __construct($url, array $options = array()){ |
|
| 12 | 12 | $this->setRequest(new POSTFile()); |
| 13 | 13 | parent::__construct($url, $options); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - public function execute($data = null) { |
|
| 16 | + public function execute($data = null){ |
|
| 17 | 17 | parent::execute($data); |
| 18 | 18 | $this->setResponse(new JSON($this->Request->getResponse(),$this->Request->getCurlObject())); |
| 19 | 19 | return $this; |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | parent::__construct($url, $options); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - public function execute($data = null) { |
|
| 16 | + public function execute($data = NULL) { |
|
| 17 | 17 | parent::execute($data); |
| 18 | 18 | $this->setResponse(new JSON($this->Request->getResponse(),$this->Request->getCurlObject())); |
| 19 | 19 | return $this; |
@@ -8,14 +8,14 @@ |
||
| 8 | 8 | |
| 9 | 9 | abstract class AbstractPostFileEntryPoint extends AbstractEntryPoint { |
| 10 | 10 | |
| 11 | - public function __construct($url, array $options = array()) { |
|
| 11 | + public function __construct($url, array $options = array()){ |
|
| 12 | 12 | $this->setRequest(new POSTFile()); |
| 13 | 13 | parent::__construct($url, $options); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - public function execute($data = null) { |
|
| 16 | + public function execute($data = null){ |
|
| 17 | 17 | parent::execute($data); |
| 18 | - $this->setResponse(new JSON($this->Request->getResponse(),$this->Request->getCurlObject())); |
|
| 18 | + $this->setResponse(new JSON($this->Request->getResponse(), $this->Request->getCurlObject())); |
|
| 19 | 19 | return $this; |
| 20 | 20 | } |
| 21 | 21 | |
@@ -8,12 +8,12 @@ |
||
| 8 | 8 | |
| 9 | 9 | abstract class AbstractPostFileEntryPoint extends AbstractEntryPoint { |
| 10 | 10 | |
| 11 | - public function __construct($url, array $options = array()) { |
|
| 11 | + public function __construct($url, array $options = array()){ |
|
| 12 | 12 | $this->setRequest(new POSTFile()); |
| 13 | 13 | parent::__construct($url, $options); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - public function execute($data = null) { |
|
| 16 | + public function execute($data = null){ |
|
| 17 | 17 | parent::execute($data); |
| 18 | 18 | $this->setResponse(new JSON($this->Request->getResponse(),$this->Request->getCurlObject())); |
| 19 | 19 | return $this; |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | parent::__construct($url, $options); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - public function execute($data = null) { |
|
| 16 | + public function execute($data = NULL) { |
|
| 17 | 17 | parent::execute($data); |
| 18 | 18 | $this->setResponse(new JSON($this->Request->getResponse(),$this->Request->getCurlObject())); |
| 19 | 19 | return $this; |
@@ -8,14 +8,14 @@ |
||
| 8 | 8 | |
| 9 | 9 | abstract class AbstractPostFileEntryPoint extends AbstractEntryPoint { |
| 10 | 10 | |
| 11 | - public function __construct($url, array $options = array()) { |
|
| 11 | + public function __construct($url, array $options = array()){ |
|
| 12 | 12 | $this->setRequest(new POSTFile()); |
| 13 | 13 | parent::__construct($url, $options); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - public function execute($data = null) { |
|
| 16 | + public function execute($data = null){ |
|
| 17 | 17 | parent::execute($data); |
| 18 | - $this->setResponse(new JSON($this->Request->getResponse(),$this->Request->getCurlObject())); |
|
| 18 | + $this->setResponse(new JSON($this->Request->getResponse(), $this->Request->getCurlObject())); |
|
| 19 | 19 | return $this; |
| 20 | 20 | } |
| 21 | 21 | |
@@ -8,12 +8,12 @@ |
||
| 8 | 8 | |
| 9 | 9 | abstract class AbstractPostFileEntryPoint extends AbstractEntryPoint { |
| 10 | 10 | |
| 11 | - public function __construct($url, array $options = array()) { |
|
| 11 | + public function __construct($url, array $options = array()){ |
|
| 12 | 12 | $this->setRequest(new POSTFile()); |
| 13 | 13 | parent::__construct($url, $options); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - public function execute($data = null) { |
|
| 16 | + public function execute($data = null){ |
|
| 17 | 17 | parent::execute($data); |
| 18 | 18 | $this->setResponse(new JSON($this->Request->getResponse(),$this->Request->getCurlObject())); |
| 19 | 19 | return $this; |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | parent::__construct($url, $options); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - public function execute($data = null) { |
|
| 16 | + public function execute($data = NULL) { |
|
| 17 | 17 | parent::execute($data); |
| 18 | 18 | $this->setResponse(new JSON($this->Request->getResponse(),$this->Request->getCurlObject())); |
| 19 | 19 | return $this; |
@@ -6,15 +6,15 @@ |
||
| 6 | 6 | |
| 7 | 7 | class OAuth2Token extends AbstractPostEntryPoint { |
| 8 | 8 | |
| 9 | - protected $_AUTH_REQUIRED = false; |
|
| 9 | + protected $_AUTH_REQUIRED = FALSE; |
|
| 10 | 10 | protected $_URL = 'oauth2/token'; |
| 11 | 11 | protected $_REQUIRED_DATA = array( |
| 12 | - 'username' => null, |
|
| 13 | - 'password' => null, |
|
| 12 | + 'username' => NULL, |
|
| 13 | + 'password' => NULL, |
|
| 14 | 14 | 'grant_type' => 'password', |
| 15 | - 'client_id' => null, |
|
| 16 | - 'client_secret' => null, |
|
| 17 | - 'platform' => null |
|
| 15 | + 'client_id' => NULL, |
|
| 16 | + 'client_secret' => NULL, |
|
| 17 | + 'platform' => NULL |
|
| 18 | 18 | ); |
| 19 | 19 | protected $_DATA_TYPE = 'array'; |
| 20 | 20 | |
@@ -151,7 +151,7 @@ |
||
| 151 | 151 | /** |
| 152 | 152 | * @param $funcName |
| 153 | 153 | * @param $className |
| 154 | - * @return bool |
|
| 154 | + * @return AbstractClient |
|
| 155 | 155 | * @throws EntryPointException |
| 156 | 156 | */ |
| 157 | 157 | public function registerEntryPoint($funcName, $className){ |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | protected $entryPoints = array(); |
| 65 | 65 | |
| 66 | - public function __construct($server = '',array $credentials = array()){ |
|
| 66 | + public function __construct($server = '', array $credentials = array()){ |
|
| 67 | 67 | $server = (empty($server)?$this->server:$server); |
| 68 | - if (!empty($server)) { |
|
| 68 | + if (!empty($server)){ |
|
| 69 | 69 | $this->setServer($server); |
| 70 | 70 | } |
| 71 | 71 | $credentials = (empty($credentials)?$this->credentials:$credentials); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * @inheritdoc |
| 80 | 80 | * @param string $server |
| 81 | 81 | */ |
| 82 | - public function setServer($server) { |
|
| 82 | + public function setServer($server){ |
|
| 83 | 83 | $this->server = $server; |
| 84 | 84 | $this->apiURL = Helpers::configureAPIURL($this->server); |
| 85 | 85 | return $this; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | /** |
| 89 | 89 | * @inheritdoc |
| 90 | 90 | */ |
| 91 | - public function getAPIUrl() { |
|
| 91 | + public function getAPIUrl(){ |
|
| 92 | 92 | return $this->apiURL; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -98,9 +98,9 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | public function setCredentials(array $credentials){ |
| 100 | 100 | $this->credentials = $credentials; |
| 101 | - if (isset($this->credentials['client_id'])) { |
|
| 101 | + if (isset($this->credentials['client_id'])){ |
|
| 102 | 102 | $token = static::getStoredToken($this->credentials['client_id']); |
| 103 | - if (!empty($token)) { |
|
| 103 | + if (!empty($token)){ |
|
| 104 | 104 | $this->setToken($token); |
| 105 | 105 | } |
| 106 | 106 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | /** |
| 134 | 134 | * @inheritdoc |
| 135 | 135 | */ |
| 136 | - public function getServer() { |
|
| 136 | + public function getServer(){ |
|
| 137 | 137 | return $this->server; |
| 138 | 138 | } |
| 139 | 139 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * @inheritdoc |
| 142 | 142 | */ |
| 143 | 143 | public function authenticated(){ |
| 144 | - return time() < $this->expiration; |
|
| 144 | + return time()<$this->expiration; |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
@@ -163,10 +163,10 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | public function registerEntryPoint($funcName, $className){ |
| 165 | 165 | $implements = class_implements($className); |
| 166 | - if (is_array($implements) && in_array('SugarAPI\SDK\EntryPoint\Interfaces\EPInterface',$implements)){ |
|
| 166 | + if (is_array($implements) && in_array('SugarAPI\SDK\EntryPoint\Interfaces\EPInterface', $implements)){ |
|
| 167 | 167 | $this->entryPoints[$funcName] = $className; |
| 168 | 168 | }else{ |
| 169 | - throw new EntryPointException($className,'Class must extend SugarAPI\SDK\EntryPoint\Interfaces\EPInterface'); |
|
| 169 | + throw new EntryPointException($className, 'Class must extend SugarAPI\SDK\EntryPoint\Interfaces\EPInterface'); |
|
| 170 | 170 | } |
| 171 | 171 | return $this; |
| 172 | 172 | } |
@@ -184,13 +184,13 @@ discard block |
||
| 184 | 184 | $EntryPoint = new $Class($this->apiURL, $params); |
| 185 | 185 | |
| 186 | 186 | if ($EntryPoint->authRequired()){ |
| 187 | - if (isset($this->token) && $this->authenticated()) { |
|
| 187 | + if (isset($this->token) && $this->authenticated()){ |
|
| 188 | 188 | $EntryPoint->setAuth($this->getToken()->access_token); |
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | return $EntryPoint; |
| 192 | 192 | }else{ |
| 193 | - throw new EntryPointException($name,'Unregistered EntryPoint'); |
|
| 193 | + throw new EntryPointException($name, 'Unregistered EntryPoint'); |
|
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | |
@@ -198,13 +198,13 @@ discard block |
||
| 198 | 198 | * @inheritdoc |
| 199 | 199 | * @throws AuthenticationException - When Login request fails |
| 200 | 200 | */ |
| 201 | - public function login() { |
|
| 201 | + public function login(){ |
|
| 202 | 202 | $EP = new OAuth2Token($this->apiURL); |
| 203 | 203 | $response = $EP->execute($this->credentials)->getResponse(); |
| 204 | 204 | if ($response->getStatus()=='200'){ |
| 205 | 205 | $this->setToken($response->getBody(FALSE)); |
| 206 | - static::storeToken($this->token,$this->credentials['client_id']); |
|
| 207 | - } else { |
|
| 206 | + static::storeToken($this->token, $this->credentials['client_id']); |
|
| 207 | + }else{ |
|
| 208 | 208 | $error = $response->getBody(); |
| 209 | 209 | throw new AuthenticationException("Login Response [".$error['error']."] ".$error['error_message']); |
| 210 | 210 | } |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | $response = $EP->execute($refreshOptions)->getResponse(); |
| 226 | 226 | if ($response->getStatus()=='200'){ |
| 227 | 227 | $this->setToken($response->getBody(FALSE)); |
| 228 | - static::storeToken($this->token,$this->credentials['client_id']); |
|
| 228 | + static::storeToken($this->token, $this->credentials['client_id']); |
|
| 229 | 229 | }else{ |
| 230 | 230 | $error = $response->getBody(); |
| 231 | 231 | throw new AuthenticationException("Refresh Response [".$error['error']."] ".$error['error_message']); |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | * @inheritdoc |
| 257 | 257 | * @param \stdClass $token |
| 258 | 258 | */ |
| 259 | - public static function storeToken($token, $client_id) { |
|
| 259 | + public static function storeToken($token, $client_id){ |
|
| 260 | 260 | static::$_STORED_TOKENS[$client_id] = $token; |
| 261 | 261 | return TRUE; |
| 262 | 262 | } |
@@ -264,14 +264,14 @@ discard block |
||
| 264 | 264 | /** |
| 265 | 265 | * @inheritdoc |
| 266 | 266 | */ |
| 267 | - public static function getStoredToken($client_id) { |
|
| 267 | + public static function getStoredToken($client_id){ |
|
| 268 | 268 | return (isset(static::$_STORED_TOKENS[$client_id])?static::$_STORED_TOKENS[$client_id]:NULL); |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | /** |
| 272 | 272 | * @inheritdoc |
| 273 | 273 | */ |
| 274 | - public static function removeStoredToken($client_id) { |
|
| 274 | + public static function removeStoredToken($client_id){ |
|
| 275 | 275 | unset(static::$_STORED_TOKENS[$client_id]); |
| 276 | 276 | return TRUE; |
| 277 | 277 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | public function __construct($server = '',array $credentials = array()){ |
| 67 | 67 | $server = (empty($server)?$this->server:$server); |
| 68 | - if (!empty($server)) { |
|
| 68 | + if (!empty($server)){ |
|
| 69 | 69 | $this->setServer($server); |
| 70 | 70 | } |
| 71 | 71 | $credentials = (empty($credentials)?$this->credentials:$credentials); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * @inheritdoc |
| 80 | 80 | * @param string $server |
| 81 | 81 | */ |
| 82 | - public function setServer($server) { |
|
| 82 | + public function setServer($server){ |
|
| 83 | 83 | $this->server = $server; |
| 84 | 84 | $this->apiURL = Helpers::configureAPIURL($this->server); |
| 85 | 85 | return $this; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | /** |
| 89 | 89 | * @inheritdoc |
| 90 | 90 | */ |
| 91 | - public function getAPIUrl() { |
|
| 91 | + public function getAPIUrl(){ |
|
| 92 | 92 | return $this->apiURL; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -98,9 +98,9 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | public function setCredentials(array $credentials){ |
| 100 | 100 | $this->credentials = $credentials; |
| 101 | - if (isset($this->credentials['client_id'])) { |
|
| 101 | + if (isset($this->credentials['client_id'])){ |
|
| 102 | 102 | $token = static::getStoredToken($this->credentials['client_id']); |
| 103 | - if (!empty($token)) { |
|
| 103 | + if (!empty($token)){ |
|
| 104 | 104 | $this->setToken($token); |
| 105 | 105 | } |
| 106 | 106 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | /** |
| 134 | 134 | * @inheritdoc |
| 135 | 135 | */ |
| 136 | - public function getServer() { |
|
| 136 | + public function getServer(){ |
|
| 137 | 137 | return $this->server; |
| 138 | 138 | } |
| 139 | 139 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $implements = class_implements($className); |
| 166 | 166 | if (is_array($implements) && in_array('SugarAPI\SDK\EntryPoint\Interfaces\EPInterface',$implements)){ |
| 167 | 167 | $this->entryPoints[$funcName] = $className; |
| 168 | - }else{ |
|
| 168 | + } else{ |
|
| 169 | 169 | throw new EntryPointException($className,'Class must extend SugarAPI\SDK\EntryPoint\Interfaces\EPInterface'); |
| 170 | 170 | } |
| 171 | 171 | return $this; |
@@ -184,12 +184,12 @@ discard block |
||
| 184 | 184 | $EntryPoint = new $Class($this->apiURL, $params); |
| 185 | 185 | |
| 186 | 186 | if ($EntryPoint->authRequired()){ |
| 187 | - if (isset($this->token) && $this->authenticated()) { |
|
| 187 | + if (isset($this->token) && $this->authenticated()){ |
|
| 188 | 188 | $EntryPoint->setAuth($this->getToken()->access_token); |
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | return $EntryPoint; |
| 192 | - }else{ |
|
| 192 | + } else{ |
|
| 193 | 193 | throw new EntryPointException($name,'Unregistered EntryPoint'); |
| 194 | 194 | } |
| 195 | 195 | } |
@@ -198,13 +198,13 @@ discard block |
||
| 198 | 198 | * @inheritdoc |
| 199 | 199 | * @throws AuthenticationException - When Login request fails |
| 200 | 200 | */ |
| 201 | - public function login() { |
|
| 201 | + public function login(){ |
|
| 202 | 202 | $EP = new OAuth2Token($this->apiURL); |
| 203 | 203 | $response = $EP->execute($this->credentials)->getResponse(); |
| 204 | 204 | if ($response->getStatus()=='200'){ |
| 205 | 205 | $this->setToken($response->getBody(FALSE)); |
| 206 | 206 | static::storeToken($this->token,$this->credentials['client_id']); |
| 207 | - } else { |
|
| 207 | + } else{ |
|
| 208 | 208 | $error = $response->getBody(); |
| 209 | 209 | throw new AuthenticationException("Login Response [".$error['error']."] ".$error['error_message']); |
| 210 | 210 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | if ($response->getStatus()=='200'){ |
| 227 | 227 | $this->setToken($response->getBody(FALSE)); |
| 228 | 228 | static::storeToken($this->token,$this->credentials['client_id']); |
| 229 | - }else{ |
|
| 229 | + } else{ |
|
| 230 | 230 | $error = $response->getBody(); |
| 231 | 231 | throw new AuthenticationException("Refresh Response [".$error['error']."] ".$error['error_message']); |
| 232 | 232 | } |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | if ($response->getStatus()=='200'){ |
| 245 | 245 | unset($this->token); |
| 246 | 246 | static::removeStoredToken($this->credentials['client_id']); |
| 247 | - }else{ |
|
| 247 | + } else{ |
|
| 248 | 248 | $error = $response->getBody(); |
| 249 | 249 | throw new AuthenticationException("Logout Response [".$error['error']."] ".$error['message']); |
| 250 | 250 | } |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | * @inheritdoc |
| 257 | 257 | * @param \stdClass $token |
| 258 | 258 | */ |
| 259 | - public static function storeToken($token, $client_id) { |
|
| 259 | + public static function storeToken($token, $client_id){ |
|
| 260 | 260 | static::$_STORED_TOKENS[$client_id] = $token; |
| 261 | 261 | return TRUE; |
| 262 | 262 | } |
@@ -264,14 +264,14 @@ discard block |
||
| 264 | 264 | /** |
| 265 | 265 | * @inheritdoc |
| 266 | 266 | */ |
| 267 | - public static function getStoredToken($client_id) { |
|
| 267 | + public static function getStoredToken($client_id){ |
|
| 268 | 268 | return (isset(static::$_STORED_TOKENS[$client_id])?static::$_STORED_TOKENS[$client_id]:NULL); |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | /** |
| 272 | 272 | * @inheritdoc |
| 273 | 273 | */ |
| 274 | - public static function removeStoredToken($client_id) { |
|
| 274 | + public static function removeStoredToken($client_id){ |
|
| 275 | 275 | unset(static::$_STORED_TOKENS[$client_id]); |
| 276 | 276 | return TRUE; |
| 277 | 277 | } |