@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | /** |
8 | 8 | * Create an access token from stored json data |
9 | 9 | * |
10 | - * @param $text |
|
10 | + * @param string $text |
|
11 | 11 | * @return AccessToken |
12 | 12 | */ |
13 | 13 | public function createFromJson($text) |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | /** |
93 | 93 | * @param array $array |
94 | - * @param mixed $key |
|
94 | + * @param string $key |
|
95 | 95 | * @return null |
96 | 96 | */ |
97 | 97 | private function getKeyIfSet($array, $key) |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public function fetchAccessToken() |
46 | 46 | { |
47 | 47 | try { |
48 | - $accessTokenJson = file_get_contents($this->filePath . '/' . $this->fileName); |
|
48 | + $accessTokenJson = file_get_contents($this->filePath.'/'.$this->fileName); |
|
49 | 49 | } catch (\ErrorException $e) { |
50 | 50 | throw new \Exception('Salesforce access token not found'); |
51 | 51 | } |
@@ -58,6 +58,6 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function saveAccessToken(AccessToken $accessToken) |
60 | 60 | { |
61 | - file_put_contents($this->filePath . '/' . $this->fileName, $accessToken->toJson()); |
|
61 | + file_put_contents($this->filePath.'/'.$this->fileName, $accessToken->toJson()); |
|
62 | 62 | } |
63 | 63 | } |
@@ -265,8 +265,8 @@ discard block |
||
265 | 265 | } catch (GuzzleRequestException $e) { |
266 | 266 | |
267 | 267 | if ($e->getResponse() === null) { |
268 | - throw $e; |
|
269 | - } |
|
268 | + throw $e; |
|
269 | + } |
|
270 | 270 | |
271 | 271 | //If its an auth error convert to an auth exception |
272 | 272 | if ($e->getResponse()->getStatusCode() == 401) { |
@@ -284,8 +284,8 @@ discard block |
||
284 | 284 | private function getAuthHeader() |
285 | 285 | { |
286 | 286 | if ($this->accessToken === null) { |
287 | - throw new AuthenticationException(0, "Access token not set"); |
|
288 | - } |
|
287 | + throw new AuthenticationException(0, "Access token not set"); |
|
288 | + } |
|
289 | 289 | |
290 | 290 | return 'Bearer ' . $this->accessToken->getAccessToken(); |
291 | 291 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function getRecord($objectType, $sfId, array $fields) |
79 | 79 | { |
80 | - $url = $this->baseUrl . '/services/data/v20.0/sobjects/' . $objectType . '/' . $sfId . '?fields=' . implode(',', $fields); |
|
80 | + $url = $this->baseUrl.'/services/data/v20.0/sobjects/'.$objectType.'/'.$sfId.'?fields='.implode(',', $fields); |
|
81 | 81 | $response = $this->makeRequest('get', $url, ['headers' => ['Authorization' => $this->getAuthHeader()]]); |
82 | 82 | |
83 | 83 | return json_decode($response->getBody(), true); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function getBlob($objectType, $sfId, $blobField) |
95 | 95 | { |
96 | - $url = $this->baseUrl . '/services/data/v20.0/sobjects/' . $objectType . '/' . $sfId . '/' . $blobField; |
|
96 | + $url = $this->baseUrl.'/services/data/v20.0/sobjects/'.$objectType.'/'.$sfId.'/'.$blobField; |
|
97 | 97 | $response = $this->makeRequest('get', $url, ['headers' => ['Authorization' => $this->getAuthHeader()]]); |
98 | 98 | |
99 | 99 | return $response; |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | public function search($query = null, $next_url = null) |
112 | 112 | { |
113 | 113 | if ( ! empty($next_url)) { |
114 | - $url = $this->baseUrl . '/' . $next_url; |
|
114 | + $url = $this->baseUrl.'/'.$next_url; |
|
115 | 115 | } else { |
116 | - $url = $this->baseUrl . '/services/data/v24.0/query/?q=' . urlencode($query); |
|
116 | + $url = $this->baseUrl.'/services/data/v24.0/query/?q='.urlencode($query); |
|
117 | 117 | } |
118 | 118 | $response = $this->makeRequest('get', $url, ['headers' => ['Authorization' => $this->getAuthHeader()]]); |
119 | 119 | $data = json_decode($response->getBody(), true); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public function updateRecord($object, $id, array $data) |
142 | 142 | { |
143 | - $url = $this->baseUrl . '/services/data/v20.0/sobjects/' . $object . '/' . $id; |
|
143 | + $url = $this->baseUrl.'/services/data/v20.0/sobjects/'.$object.'/'.$id; |
|
144 | 144 | |
145 | 145 | $this->makeRequest('patch', $url, [ |
146 | 146 | 'headers' => ['Content-Type' => 'application/json', 'Authorization' => $this->getAuthHeader()], |
@@ -160,9 +160,9 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function createRecord($object, $data) |
162 | 162 | { |
163 | - $url = $this->baseUrl . '/services/data/v20.0/sobjects/' . $object . '/'; |
|
163 | + $url = $this->baseUrl.'/services/data/v20.0/sobjects/'.$object.'/'; |
|
164 | 164 | |
165 | - $response = $this->makeRequest('post', $url, [ |
|
165 | + $response = $this->makeRequest('post', $url, [ |
|
166 | 166 | 'headers' => ['Content-Type' => 'application/json', 'Authorization' => $this->getAuthHeader()], |
167 | 167 | 'body' => json_encode($data) |
168 | 168 | ]); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function deleteRecord($object, $id) |
183 | 183 | { |
184 | - $url = $this->baseUrl . '/services/data/v20.0/sobjects/' . $object . '/' . $id; |
|
184 | + $url = $this->baseUrl.'/services/data/v20.0/sobjects/'.$object.'/'.$id; |
|
185 | 185 | |
186 | 186 | $this->makeRequest('delete', $url, ['headers' => ['Authorization' => $this->getAuthHeader()]]); |
187 | 187 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public function authorizeConfirm($code, $redirect_url) |
200 | 200 | { |
201 | - $url = $this->salesforceLoginUrl . 'services/oauth2/token'; |
|
201 | + $url = $this->salesforceLoginUrl.'services/oauth2/token'; |
|
202 | 202 | |
203 | 203 | $post_data = [ |
204 | 204 | 'grant_type' => 'authorization_code', |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | 'grant_type' => 'authorization_code' |
229 | 229 | ]; |
230 | 230 | |
231 | - return $this->salesforceLoginUrl . 'services/oauth2/authorize?' . http_build_query($params); |
|
231 | + return $this->salesforceLoginUrl.'services/oauth2/authorize?'.http_build_query($params); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | /** |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function refreshToken() |
241 | 241 | { |
242 | - $url = $this->salesforceLoginUrl . 'services/oauth2/token'; |
|
242 | + $url = $this->salesforceLoginUrl.'services/oauth2/token'; |
|
243 | 243 | |
244 | 244 | $post_data = [ |
245 | 245 | 'grant_type' => 'refresh_token', |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | throw new AuthenticationException(0, "Access token not set"); |
305 | 305 | } |
306 | 306 | |
307 | - return 'Bearer ' . $this->accessToken->getAccessToken(); |
|
307 | + return 'Bearer '.$this->accessToken->getAccessToken(); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | } |