@@ -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 @@ discard block |
||
4 | 4 | |
5 | 5 | use SugarAPI\SDK\Request\Abstracts\AbstractRequest; |
6 | 6 | |
7 | -class POST extends AbstractRequest{ |
|
7 | +class POST extends AbstractRequest { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * @inheritdoc |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * JSON Encode Body |
33 | 33 | * @inheritdoc |
34 | 34 | */ |
35 | - public function setBody($body) { |
|
35 | + public function setBody($body){ |
|
36 | 36 | return parent::setBody(json_encode($body)); |
37 | 37 | } |
38 | 38 | } |
39 | 39 | \ No newline at end of file |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use SugarAPI\SDK\Request\Abstracts\AbstractRequest; |
6 | 6 | |
7 | -class POST extends AbstractRequest{ |
|
7 | +class POST extends AbstractRequest { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * @inheritdoc |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * JSON Encode Body |
33 | 33 | * @inheritdoc |
34 | 34 | */ |
35 | - public function setBody($body) { |
|
35 | + public function setBody($body){ |
|
36 | 36 | return parent::setBody(json_encode($body)); |
37 | 37 | } |
38 | 38 | } |
39 | 39 | \ No newline at end of file |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use SugarAPI\SDK\Response\Interfaces\ResponseInterface; |
6 | 6 | |
7 | -abstract class AbstractResponse implements ResponseInterface{ |
|
7 | +abstract class AbstractResponse implements ResponseInterface { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Full Curl Response |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | */ |
37 | 37 | protected $error; |
38 | 38 | |
39 | - public function __construct($curlResponse,$curlRequest){ |
|
39 | + public function __construct($curlResponse, $curlRequest){ |
|
40 | 40 | $this->CurlResponse = $curlResponse; |
41 | - if ($this->checkErrors($curlRequest)) { |
|
41 | + if ($this->checkErrors($curlRequest)){ |
|
42 | 42 | $this->extractResponse($curlRequest); |
43 | 43 | } |
44 | 44 | $this->setStatus($curlRequest); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @param $curlRequest - Curl resource |
50 | 50 | */ |
51 | 51 | protected function setStatus($curlRequest){ |
52 | - $this->status = curl_getinfo($curlRequest,CURLINFO_HTTP_CODE); |
|
52 | + $this->status = curl_getinfo($curlRequest, CURLINFO_HTTP_CODE); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @param $curlRequest |
58 | 58 | */ |
59 | 59 | protected function extractResponse($curlRequest){ |
60 | - $header_size = curl_getinfo($curlRequest,CURLINFO_HEADER_SIZE); |
|
60 | + $header_size = curl_getinfo($curlRequest, CURLINFO_HEADER_SIZE); |
|
61 | 61 | $this->headers = substr($this->CurlResponse, 0, $header_size); |
62 | 62 | $this->body = substr($this->CurlResponse, $header_size); |
63 | 63 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @return bool |
69 | 69 | */ |
70 | 70 | protected function checkErrors($curlRequest){ |
71 | - if (curl_errno($curlRequest) !== CURLE_OK) { |
|
71 | + if (curl_errno($curlRequest)!==CURLE_OK){ |
|
72 | 72 | $this->error = curl_error($curlRequest); |
73 | 73 | return false; |
74 | 74 | } |
@@ -85,14 +85,14 @@ discard block |
||
85 | 85 | /** |
86 | 86 | * @inheritdoc |
87 | 87 | */ |
88 | - public function getBody() { |
|
88 | + public function getBody(){ |
|
89 | 89 | return $this->body; |
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
93 | 93 | * @inheritdoc |
94 | 94 | */ |
95 | - public function getHeaders() { |
|
95 | + public function getHeaders(){ |
|
96 | 96 | return $this->headers; |
97 | 97 | } |
98 | 98 |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use SugarAPI\SDK\Response\Interfaces\ResponseInterface; |
6 | 6 | |
7 | -abstract class AbstractResponse implements ResponseInterface{ |
|
7 | +abstract class AbstractResponse implements ResponseInterface { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Full Curl Response |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | public function __construct($curlResponse,$curlRequest){ |
40 | 40 | $this->CurlResponse = $curlResponse; |
41 | - if ($this->checkErrors($curlRequest)) { |
|
41 | + if ($this->checkErrors($curlRequest)){ |
|
42 | 42 | $this->extractResponse($curlRequest); |
43 | 43 | } |
44 | 44 | $this->setStatus($curlRequest); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @return bool |
69 | 69 | */ |
70 | 70 | protected function checkErrors($curlRequest){ |
71 | - if (curl_errno($curlRequest) !== CURLE_OK) { |
|
71 | + if (curl_errno($curlRequest) !== CURLE_OK){ |
|
72 | 72 | $this->error = curl_error($curlRequest); |
73 | 73 | return false; |
74 | 74 | } |
@@ -85,14 +85,14 @@ discard block |
||
85 | 85 | /** |
86 | 86 | * @inheritdoc |
87 | 87 | */ |
88 | - public function getBody() { |
|
88 | + public function getBody(){ |
|
89 | 89 | return $this->body; |
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
93 | 93 | * @inheritdoc |
94 | 94 | */ |
95 | - public function getHeaders() { |
|
95 | + public function getHeaders(){ |
|
96 | 96 | return $this->headers; |
97 | 97 | } |
98 | 98 |
@@ -70,9 +70,9 @@ |
||
70 | 70 | protected function checkErrors($curlRequest){ |
71 | 71 | if (curl_errno($curlRequest) !== CURLE_OK) { |
72 | 72 | $this->error = curl_error($curlRequest); |
73 | - return false; |
|
73 | + return FALSE; |
|
74 | 74 | } |
75 | - return true; |
|
75 | + return TRUE; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | protected $destinationPath; |
20 | 20 | |
21 | - public function __construct($curlResponse, $curlRequest,$destination = null) { |
|
21 | + public function __construct($curlResponse, $curlRequest, $destination = null){ |
|
22 | 22 | parent::__construct($curlResponse, $curlRequest); |
23 | 23 | $this->extractFileName(); |
24 | - if (!empty($destination)) { |
|
24 | + if (!empty($destination)){ |
|
25 | 25 | $this->setupDestination($destination); |
26 | 26 | $this->writeFile(); |
27 | 27 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | if (empty($destination)){ |
36 | 36 | $destination = sys_get_temp_dir().'/SugarAPI'; |
37 | 37 | if (!file_exists($destination)){ |
38 | - mkdir($destination,0777); |
|
38 | + mkdir($destination, 0777); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | $this->destinationPath = $destination; |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | * Extract the filename from the Headers, and store it in filename property |
46 | 46 | */ |
47 | 47 | protected function extractFileName(){ |
48 | - foreach (explode("\r\n",$this->headers) as $header) |
|
48 | + foreach (explode("\r\n", $this->headers) as $header) |
|
49 | 49 | { |
50 | - if (strpos($header,'filename')!==FALSE){ |
|
51 | - $this->fileName = substr($header,(strpos($header,"\"")+1),-1); |
|
50 | + if (strpos($header, 'filename')!==FALSE){ |
|
51 | + $this->fileName = substr($header, (strpos($header, "\"")+1), -1); |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | } |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | * Write the downloaded file |
66 | 66 | */ |
67 | 67 | protected function writeFile(){ |
68 | - $fileHandle = fopen($this->file(),'w+'); |
|
69 | - fwrite($fileHandle,$this->body); |
|
68 | + $fileHandle = fopen($this->file(), 'w+'); |
|
69 | + fwrite($fileHandle, $this->body); |
|
70 | 70 | fclose($fileHandle); |
71 | 71 | } |
72 | 72 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @return string |
76 | 76 | */ |
77 | 77 | public function file(){ |
78 | - return rtrim($this->destinationPath,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$this->fileName; |
|
78 | + return rtrim($this->destinationPath, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$this->fileName; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | } |
82 | 82 | \ No newline at end of file |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | protected $destinationPath; |
20 | 20 | |
21 | - public function __construct($curlResponse, $curlRequest,$destination = null) { |
|
21 | + public function __construct($curlResponse, $curlRequest,$destination = null){ |
|
22 | 22 | parent::__construct($curlResponse, $curlRequest); |
23 | 23 | $this->extractFileName(); |
24 | - if (!empty($destination)) { |
|
24 | + if (!empty($destination)){ |
|
25 | 25 | $this->setupDestination($destination); |
26 | 26 | $this->writeFile(); |
27 | 27 | } |
@@ -45,8 +45,7 @@ discard block |
||
45 | 45 | * Extract the filename from the Headers, and store it in filename property |
46 | 46 | */ |
47 | 47 | protected function extractFileName(){ |
48 | - foreach (explode("\r\n",$this->headers) as $header) |
|
49 | - { |
|
48 | + foreach (explode("\r\n",$this->headers) as $header){ |
|
50 | 49 | if (strpos($header,'filename')!==FALSE){ |
51 | 50 | $this->fileName = substr($header,(strpos($header,"\"")+1),-1); |
52 | 51 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | protected $destinationPath; |
20 | 20 | |
21 | - public function __construct($curlResponse, $curlRequest,$destination = null) { |
|
21 | + public function __construct($curlResponse, $curlRequest,$destination = NULL) { |
|
22 | 22 | parent::__construct($curlResponse, $curlRequest); |
23 | 23 | $this->extractFileName(); |
24 | 24 | if (!empty($destination)) { |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * Configure the Destination path to store the File response |
32 | 32 | * @param null $destination |
33 | 33 | */ |
34 | - protected function setupDestination($destination = null){ |
|
34 | + protected function setupDestination($destination = NULL){ |
|
35 | 35 | if (empty($destination)){ |
36 | 36 | $destination = sys_get_temp_dir().'/SugarAPI'; |
37 | 37 | if (!file_exists($destination)){ |
@@ -72,6 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | /** |
74 | 74 | * @inheritdoc |
75 | + * @param string $server |
|
75 | 76 | */ |
76 | 77 | public function setServer($server) { |
77 | 78 | $this->server = $server; |
@@ -150,7 +151,7 @@ discard block |
||
150 | 151 | /** |
151 | 152 | * @param $funcName |
152 | 153 | * @param $className |
153 | - * @return bool |
|
154 | + * @return AbstractClient |
|
154 | 155 | * @throws EntryPointException |
155 | 156 | */ |
156 | 157 | public function registerEntryPoint($funcName, $className){ |
@@ -246,6 +247,7 @@ discard block |
||
246 | 247 | |
247 | 248 | /** |
248 | 249 | * @inheritdoc |
250 | + * @param \stdClass $token |
|
249 | 251 | */ |
250 | 252 | public static function storeToken($token, $client_id) { |
251 | 253 | static::$_STORED_TOKENS[$client_id] = $token; |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | */ |
61 | 61 | protected $entryPoints = array(); |
62 | 62 | |
63 | - public function __construct($server = '',array $credentials = array()){ |
|
64 | - if (!empty($server)) { |
|
63 | + public function __construct($server = '', array $credentials = array()){ |
|
64 | + if (!empty($server)){ |
|
65 | 65 | $this->setServer($server); |
66 | 66 | } |
67 | 67 | if (!empty($credentials)){ |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | /** |
74 | 74 | * @inheritdoc |
75 | 75 | */ |
76 | - public function setServer($server) { |
|
76 | + public function setServer($server){ |
|
77 | 77 | $this->server = $server; |
78 | 78 | $this->apiURL = Helpers::configureAPIURL($this->server); |
79 | 79 | return $this; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | /** |
83 | 83 | * @inheritdoc |
84 | 84 | */ |
85 | - public function getAPIUrl() { |
|
85 | + public function getAPIUrl(){ |
|
86 | 86 | return $this->apiURL; |
87 | 87 | } |
88 | 88 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | /** |
126 | 126 | * @inheritdoc |
127 | 127 | */ |
128 | - public function getServer() { |
|
128 | + public function getServer(){ |
|
129 | 129 | return $this->server; |
130 | 130 | } |
131 | 131 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @inheritdoc |
134 | 134 | */ |
135 | 135 | public function authenticated(){ |
136 | - return time() < $this->expiration; |
|
136 | + return time()<$this->expiration; |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -155,10 +155,10 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function registerEntryPoint($funcName, $className){ |
157 | 157 | $implements = class_implements($className); |
158 | - if (is_array($implements) && in_array('SugarAPI\SDK\EntryPoint\Interfaces\EPInterface',$implements)){ |
|
158 | + if (is_array($implements) && in_array('SugarAPI\SDK\EntryPoint\Interfaces\EPInterface', $implements)){ |
|
159 | 159 | $this->entryPoints[$funcName] = $className; |
160 | 160 | }else{ |
161 | - throw new EntryPointException($className,'Class must extend SugarAPI\SDK\EntryPoint\Interfaces\EPInterface'); |
|
161 | + throw new EntryPointException($className, 'Class must extend SugarAPI\SDK\EntryPoint\Interfaces\EPInterface'); |
|
162 | 162 | } |
163 | 163 | return $this; |
164 | 164 | } |
@@ -176,13 +176,13 @@ discard block |
||
176 | 176 | $EntryPoint = new $Class($this->apiURL, $params); |
177 | 177 | |
178 | 178 | if ($EntryPoint->authRequired()){ |
179 | - if (isset($this->token) && $this->authenticated()) { |
|
179 | + if (isset($this->token) && $this->authenticated()){ |
|
180 | 180 | $EntryPoint->setAuth($this->getToken()->access_token); |
181 | 181 | } |
182 | 182 | } |
183 | 183 | return $EntryPoint; |
184 | 184 | }else{ |
185 | - throw new EntryPointException($name,'Unregistered EntryPoint'); |
|
185 | + throw new EntryPointException($name, 'Unregistered EntryPoint'); |
|
186 | 186 | } |
187 | 187 | } |
188 | 188 | |
@@ -190,13 +190,13 @@ discard block |
||
190 | 190 | * @inheritdoc |
191 | 191 | * @throws AuthenticationException - When Login request fails |
192 | 192 | */ |
193 | - public function login() { |
|
193 | + public function login(){ |
|
194 | 194 | $EP = new OAuth2Token($this->apiURL); |
195 | 195 | $response = $EP->execute($this->credentials)->getResponse(); |
196 | 196 | if ($response->getStatus()=='200'){ |
197 | 197 | $this->setToken($response->getBody(false)); |
198 | - static::storeToken($this->token,$this->credentials['client_id']); |
|
199 | - } else { |
|
198 | + static::storeToken($this->token, $this->credentials['client_id']); |
|
199 | + }else{ |
|
200 | 200 | $error = $response->getBody(); |
201 | 201 | throw new AuthenticationException("Login Response [".$error['error']."] ".$error['error_message']); |
202 | 202 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $response = $EP->execute($refreshOptions)->getResponse(); |
218 | 218 | if ($response->getStatus()=='200'){ |
219 | 219 | $this->setToken($response->getBody(false)); |
220 | - static::storeToken($this->token,$this->credentials['client_id']); |
|
220 | + static::storeToken($this->token, $this->credentials['client_id']); |
|
221 | 221 | }else{ |
222 | 222 | $error = $response->getBody(); |
223 | 223 | throw new AuthenticationException("Refresh Response [".$error['error']."] ".$error['error_message']); |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | /** |
248 | 248 | * @inheritdoc |
249 | 249 | */ |
250 | - public static function storeToken($token, $client_id) { |
|
250 | + public static function storeToken($token, $client_id){ |
|
251 | 251 | static::$_STORED_TOKENS[$client_id] = $token; |
252 | 252 | return true; |
253 | 253 | } |
@@ -255,14 +255,14 @@ discard block |
||
255 | 255 | /** |
256 | 256 | * @inheritdoc |
257 | 257 | */ |
258 | - public static function getStoredToken($client_id) { |
|
258 | + public static function getStoredToken($client_id){ |
|
259 | 259 | return static::$_STORED_TOKENS[$client_id]; |
260 | 260 | } |
261 | 261 | |
262 | 262 | /** |
263 | 263 | * @inheritdoc |
264 | 264 | */ |
265 | - public static function removeStoredToken($client_id) { |
|
265 | + public static function removeStoredToken($client_id){ |
|
266 | 266 | unset(static::$_STORED_TOKENS[$client_id]); |
267 | 267 | return true; |
268 | 268 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | protected $entryPoints = array(); |
62 | 62 | |
63 | 63 | public function __construct($server = '',array $credentials = array()){ |
64 | - if (!empty($server)) { |
|
64 | + if (!empty($server)){ |
|
65 | 65 | $this->setServer($server); |
66 | 66 | } |
67 | 67 | if (!empty($credentials)){ |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | /** |
74 | 74 | * @inheritdoc |
75 | 75 | */ |
76 | - public function setServer($server) { |
|
76 | + public function setServer($server){ |
|
77 | 77 | $this->server = $server; |
78 | 78 | $this->apiURL = Helpers::configureAPIURL($this->server); |
79 | 79 | return $this; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | /** |
83 | 83 | * @inheritdoc |
84 | 84 | */ |
85 | - public function getAPIUrl() { |
|
85 | + public function getAPIUrl(){ |
|
86 | 86 | return $this->apiURL; |
87 | 87 | } |
88 | 88 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | /** |
126 | 126 | * @inheritdoc |
127 | 127 | */ |
128 | - public function getServer() { |
|
128 | + public function getServer(){ |
|
129 | 129 | return $this->server; |
130 | 130 | } |
131 | 131 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $implements = class_implements($className); |
158 | 158 | if (is_array($implements) && in_array('SugarAPI\SDK\EntryPoint\Interfaces\EPInterface',$implements)){ |
159 | 159 | $this->entryPoints[$funcName] = $className; |
160 | - }else{ |
|
160 | + } else{ |
|
161 | 161 | throw new EntryPointException($className,'Class must extend SugarAPI\SDK\EntryPoint\Interfaces\EPInterface'); |
162 | 162 | } |
163 | 163 | return $this; |
@@ -176,12 +176,12 @@ discard block |
||
176 | 176 | $EntryPoint = new $Class($this->apiURL, $params); |
177 | 177 | |
178 | 178 | if ($EntryPoint->authRequired()){ |
179 | - if (isset($this->token) && $this->authenticated()) { |
|
179 | + if (isset($this->token) && $this->authenticated()){ |
|
180 | 180 | $EntryPoint->setAuth($this->getToken()->access_token); |
181 | 181 | } |
182 | 182 | } |
183 | 183 | return $EntryPoint; |
184 | - }else{ |
|
184 | + } else{ |
|
185 | 185 | throw new EntryPointException($name,'Unregistered EntryPoint'); |
186 | 186 | } |
187 | 187 | } |
@@ -190,13 +190,13 @@ discard block |
||
190 | 190 | * @inheritdoc |
191 | 191 | * @throws AuthenticationException - When Login request fails |
192 | 192 | */ |
193 | - public function login() { |
|
193 | + public function login(){ |
|
194 | 194 | $EP = new OAuth2Token($this->apiURL); |
195 | 195 | $response = $EP->execute($this->credentials)->getResponse(); |
196 | 196 | if ($response->getStatus()=='200'){ |
197 | 197 | $this->setToken($response->getBody(false)); |
198 | 198 | static::storeToken($this->token,$this->credentials['client_id']); |
199 | - } else { |
|
199 | + } else{ |
|
200 | 200 | $error = $response->getBody(); |
201 | 201 | throw new AuthenticationException("Login Response [".$error['error']."] ".$error['error_message']); |
202 | 202 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | if ($response->getStatus()=='200'){ |
219 | 219 | $this->setToken($response->getBody(false)); |
220 | 220 | static::storeToken($this->token,$this->credentials['client_id']); |
221 | - }else{ |
|
221 | + } else{ |
|
222 | 222 | $error = $response->getBody(); |
223 | 223 | throw new AuthenticationException("Refresh Response [".$error['error']."] ".$error['error_message']); |
224 | 224 | } |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | if ($response->getStatus()=='200'){ |
237 | 237 | unset($this->token); |
238 | 238 | static::removeStoredToken($this->credentials['client_id']); |
239 | - }else{ |
|
239 | + } else{ |
|
240 | 240 | $error = $response->getBody(); |
241 | 241 | throw new AuthenticationException("Logout Response [".$error['error']."] ".$error['message']); |
242 | 242 | } |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | /** |
248 | 248 | * @inheritdoc |
249 | 249 | */ |
250 | - public static function storeToken($token, $client_id) { |
|
250 | + public static function storeToken($token, $client_id){ |
|
251 | 251 | static::$_STORED_TOKENS[$client_id] = $token; |
252 | 252 | return true; |
253 | 253 | } |
@@ -255,14 +255,14 @@ discard block |
||
255 | 255 | /** |
256 | 256 | * @inheritdoc |
257 | 257 | */ |
258 | - public static function getStoredToken($client_id) { |
|
258 | + public static function getStoredToken($client_id){ |
|
259 | 259 | return static::$_STORED_TOKENS[$client_id]; |
260 | 260 | } |
261 | 261 | |
262 | 262 | /** |
263 | 263 | * @inheritdoc |
264 | 264 | */ |
265 | - public static function removeStoredToken($client_id) { |
|
265 | + public static function removeStoredToken($client_id){ |
|
266 | 266 | unset(static::$_STORED_TOKENS[$client_id]); |
267 | 267 | return true; |
268 | 268 | } |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $EP = new OAuth2Token($this->apiURL); |
195 | 195 | $response = $EP->execute($this->credentials)->getResponse(); |
196 | 196 | if ($response->getStatus()=='200'){ |
197 | - $this->setToken($response->getBody(false)); |
|
197 | + $this->setToken($response->getBody(FALSE)); |
|
198 | 198 | static::storeToken($this->token,$this->credentials['client_id']); |
199 | 199 | } else { |
200 | 200 | $error = $response->getBody(); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $EP = new RefreshToken($this->apiURL); |
217 | 217 | $response = $EP->execute($refreshOptions)->getResponse(); |
218 | 218 | if ($response->getStatus()=='200'){ |
219 | - $this->setToken($response->getBody(false)); |
|
219 | + $this->setToken($response->getBody(FALSE)); |
|
220 | 220 | static::storeToken($this->token,$this->credentials['client_id']); |
221 | 221 | }else{ |
222 | 222 | $error = $response->getBody(); |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | */ |
250 | 250 | public static function storeToken($token, $client_id) { |
251 | 251 | static::$_STORED_TOKENS[$client_id] = $token; |
252 | - return true; |
|
252 | + return TRUE; |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | /** |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | */ |
265 | 265 | public static function removeStoredToken($client_id) { |
266 | 266 | unset(static::$_STORED_TOKENS[$client_id]); |
267 | - return true; |
|
267 | + return TRUE; |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | } |
271 | 271 | \ No newline at end of file |
@@ -17,8 +17,8 @@ |
||
17 | 17 | /** |
18 | 18 | * @inheritdoc |
19 | 19 | */ |
20 | - public function getBody($asArray = true) { |
|
21 | - return json_decode($this->body,$asArray); |
|
20 | + public function getBody($asArray = true){ |
|
21 | + return json_decode($this->body, $asArray); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | } |
25 | 25 | \ No newline at end of file |
@@ -17,7 +17,7 @@ |
||
17 | 17 | /** |
18 | 18 | * @inheritdoc |
19 | 19 | */ |
20 | - public function getBody($asArray = true) { |
|
20 | + public function getBody($asArray = true){ |
|
21 | 21 | return json_decode($this->body,$asArray); |
22 | 22 | } |
23 | 23 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | /** |
18 | 18 | * @inheritdoc |
19 | 19 | */ |
20 | - public function getBody($asArray = true) { |
|
20 | + public function getBody($asArray = TRUE) { |
|
21 | 21 | return json_decode($this->body,$asArray); |
22 | 22 | } |
23 | 23 |
@@ -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 |
@@ -8,8 +8,8 @@ |
||
8 | 8 | |
9 | 9 | protected $message = 'Authentication Exception [%s] occurred in SDK Client. Message: %s'; |
10 | 10 | |
11 | - public function __construct($message) { |
|
12 | - parent::__construct(sprintf($this->message,get_called_class(),$message)); |
|
11 | + public function __construct($message){ |
|
12 | + parent::__construct(sprintf($this->message, get_called_class(), $message)); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | } |
16 | 16 | \ No newline at end of file |
@@ -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 |
@@ -8,8 +8,8 @@ |
||
8 | 8 | |
9 | 9 | protected $message = 'EntryPoint Exception [%s] occurred on EntryPoint %s: %s'; |
10 | 10 | |
11 | - public function __construct($EntryPoint,$data) { |
|
12 | - parent::__construct(sprintf($this->message,get_called_class(),$EntryPoint,$data)); |
|
11 | + public function __construct($EntryPoint, $data){ |
|
12 | + parent::__construct(sprintf($this->message, get_called_class(), $EntryPoint, $data)); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | } |
16 | 16 | \ No newline at end of file |
@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | protected $message = 'EntryPoint Exception [%s] occurred on EntryPoint %s: %s'; |
10 | 10 | |
11 | - public function __construct($EntryPoint,$data) { |
|
11 | + public function __construct($EntryPoint,$data){ |
|
12 | 12 | parent::__construct(sprintf($this->message,get_called_class(),$EntryPoint,$data)); |
13 | 13 | } |
14 | 14 |