@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * Register an EntryPoint method on the SugarAPI object. |
121 | 121 | * Allows for loading custom EntryPoints, so long as custom EntryPoints are autoloaded accordingly |
122 | 122 | * @param $funcName - name of Method to be called on SugarAPI Object |
123 | - * @param $className - full name of EntryPoint Class that will be utilized |
|
123 | + * @param string $className - full name of EntryPoint Class that will be utilized |
|
124 | 124 | * @throws SDKException |
125 | 125 | */ |
126 | 126 | public function registerEntryPoint($funcName, $className){ |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | |
191 | 191 | /** |
192 | 192 | * Get the configured Rest v10 URL |
193 | - * @return mixed |
|
193 | + * @return string |
|
194 | 194 | */ |
195 | 195 | public function getURL(){ |
196 | 196 | return $this->url; |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | * Configure the static property $_DEFAULTS with settings from defaults.php |
79 | 79 | */ |
80 | 80 | protected function loadDefaults(){ |
81 | - if (empty(static::$_DEFAULTS)) { |
|
81 | + if (empty(static::$_DEFAULTS)){ |
|
82 | 82 | include __DIR__ . DIRECTORY_SEPARATOR . 'defaults.php'; |
83 | - if (isset($defaults)) { |
|
83 | + if (isset($defaults)){ |
|
84 | 84 | static::$_DEFAULTS = $defaults; |
85 | 85 | } |
86 | 86 | } |
@@ -146,12 +146,12 @@ discard block |
||
146 | 146 | if ($EntryPoint->authRequired()){ |
147 | 147 | if (isset($this->authToken)){ |
148 | 148 | $EntryPoint->configureAuth($this->authToken->access_token); |
149 | - }else{ |
|
149 | + } else{ |
|
150 | 150 | throw new AuthenticationException('Authentication is required for EntryPoint ['.$name.'].'); |
151 | 151 | } |
152 | 152 | } |
153 | 153 | return $EntryPoint; |
154 | - }else{ |
|
154 | + } else{ |
|
155 | 155 | throw new SDKException('Method '.$name.', is not a registered method of the SugarAPI SDK'); |
156 | 156 | } |
157 | 157 | } |
@@ -219,13 +219,13 @@ |
||
219 | 219 | * Force Logout of SugarAPI Object |
220 | 220 | */ |
221 | 221 | public function logout(){ |
222 | - if (!empty($this->authToken)){ |
|
223 | - $response = $this->oauth2Logout()->execute()->getResponse(); |
|
224 | - if ($response->getStatus()=='200'){ |
|
225 | - unset($this->authToken); |
|
226 | - unset($this->authExpiration); |
|
227 | - } |
|
228 | - } |
|
222 | + if (!empty($this->authToken)){ |
|
223 | + $response = $this->oauth2Logout()->execute()->getResponse(); |
|
224 | + if ($response->getStatus()=='200'){ |
|
225 | + unset($this->authToken); |
|
226 | + unset($this->authExpiration); |
|
227 | + } |
|
228 | + } |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | * Configure the static property $_DEFAULTS with settings from defaults.php |
85 | 85 | */ |
86 | 86 | protected function loadDefaults(){ |
87 | - if (empty(static::$_DEFAULTS)) { |
|
88 | - include __DIR__ . DIRECTORY_SEPARATOR . 'defaults.php'; |
|
89 | - if (isset($defaults)) { |
|
87 | + if (empty(static::$_DEFAULTS)){ |
|
88 | + include __DIR__.DIRECTORY_SEPARATOR.'defaults.php'; |
|
89 | + if (isset($defaults)){ |
|
90 | 90 | static::$_DEFAULTS = $defaults; |
91 | 91 | } |
92 | 92 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $response = $this->oauth2Token()->data($this->authOptions)->execute()->getResponse(); |
177 | 177 | if ($response->getStatus()=='200'){ |
178 | 178 | $this->setAuthToken($response->getBody()); |
179 | - } else{ |
|
179 | + }else{ |
|
180 | 180 | throw new AuthenticationException($response->getBody()); |
181 | 181 | } |
182 | 182 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $response = $this->oauth2Refresh()->data($refreshOptions)->execute()->getResponse(); |
203 | 203 | if ($response->getStatus()=='200'){ |
204 | 204 | $this->setAuthToken($response->getBody()); |
205 | - } else{ |
|
205 | + }else{ |
|
206 | 206 | throw new AuthenticationException($response->getBody()); |
207 | 207 | } |
208 | 208 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * @return bool |
213 | 213 | */ |
214 | 214 | public function authExpired(){ |
215 | - return time() >= $this->authExpiration; |
|
215 | + return time()>=$this->authExpiration; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |