@@ -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 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public function getRecord($objectType, $sfId, array $fields) |
| 78 | 78 | { |
| 79 | - $url = $this->baseUrl . '/services/data/v20.0/sobjects/' . $objectType . '/' . $sfId . '?fields=' . implode(',', $fields); |
|
| 79 | + $url = $this->baseUrl.'/services/data/v20.0/sobjects/'.$objectType.'/'.$sfId.'?fields='.implode(',', $fields); |
|
| 80 | 80 | $response = $this->makeRequest('get', $url, ['headers' => ['Authorization' => $this->getAuthHeader()]]); |
| 81 | 81 | |
| 82 | 82 | return json_decode($response->getBody(), true); |
@@ -94,9 +94,9 @@ discard block |
||
| 94 | 94 | public function search($query = null, $next_url = null) |
| 95 | 95 | { |
| 96 | 96 | if ( ! empty($next_url)) { |
| 97 | - $url = $this->baseUrl . '/' . $next_url; |
|
| 97 | + $url = $this->baseUrl.'/'.$next_url; |
|
| 98 | 98 | } else { |
| 99 | - $url = $this->baseUrl . '/services/data/v24.0/query/?q=' . urlencode($query); |
|
| 99 | + $url = $this->baseUrl.'/services/data/v24.0/query/?q='.urlencode($query); |
|
| 100 | 100 | } |
| 101 | 101 | $response = $this->makeRequest('get', $url, ['headers' => ['Authorization' => $this->getAuthHeader()]]); |
| 102 | 102 | $data = json_decode($response->getBody(), true); |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | public function updateRecord($object, $id, array $data) |
| 125 | 125 | { |
| 126 | - $url = $this->baseUrl . '/services/data/v20.0/sobjects/' . $object . '/' . $id; |
|
| 126 | + $url = $this->baseUrl.'/services/data/v20.0/sobjects/'.$object.'/'.$id; |
|
| 127 | 127 | |
| 128 | 128 | $this->makeRequest('patch', $url, [ |
| 129 | 129 | 'headers' => ['Content-Type' => 'application/json', 'Authorization' => $this->getAuthHeader()], |
@@ -143,9 +143,9 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public function createRecord($object, $data) |
| 145 | 145 | { |
| 146 | - $url = $this->baseUrl . '/services/data/v20.0/sobjects/' . $object . '/'; |
|
| 146 | + $url = $this->baseUrl.'/services/data/v20.0/sobjects/'.$object.'/'; |
|
| 147 | 147 | |
| 148 | - $response = $this->makeRequest('post', $url, [ |
|
| 148 | + $response = $this->makeRequest('post', $url, [ |
|
| 149 | 149 | 'headers' => ['Content-Type' => 'application/json', 'Authorization' => $this->getAuthHeader()], |
| 150 | 150 | 'body' => json_encode($data) |
| 151 | 151 | ]); |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | public function deleteRecord($object, $id) |
| 166 | 166 | { |
| 167 | - $url = $this->baseUrl . '/services/data/v20.0/sobjects/' . $object . '/' . $id; |
|
| 167 | + $url = $this->baseUrl.'/services/data/v20.0/sobjects/'.$object.'/'.$id; |
|
| 168 | 168 | |
| 169 | 169 | $this->makeRequest('delete', $url, ['headers' => ['Authorization' => $this->getAuthHeader()]]); |
| 170 | 170 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | public function authorizeConfirm($code, $redirect_url) |
| 183 | 183 | { |
| 184 | - $url = $this->salesforceLoginUrl . 'services/oauth2/token'; |
|
| 184 | + $url = $this->salesforceLoginUrl.'services/oauth2/token'; |
|
| 185 | 185 | |
| 186 | 186 | $post_data = [ |
| 187 | 187 | 'grant_type' => 'authorization_code', |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | 'grant_type' => 'authorization_code' |
| 212 | 212 | ]; |
| 213 | 213 | |
| 214 | - return $this->salesforceLoginUrl . 'services/oauth2/authorize?' . http_build_query($params); |
|
| 214 | + return $this->salesforceLoginUrl.'services/oauth2/authorize?'.http_build_query($params); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /** |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | public function refreshToken() |
| 224 | 224 | { |
| 225 | - $url = $this->salesforceLoginUrl . 'services/oauth2/token'; |
|
| 225 | + $url = $this->salesforceLoginUrl.'services/oauth2/token'; |
|
| 226 | 226 | |
| 227 | 227 | $post_data = [ |
| 228 | 228 | 'grant_type' => 'refresh_token', |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | throw new AuthenticationException(0, "Access token not set"); |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - return 'Bearer ' . $this->accessToken->getAccessToken(); |
|
| 290 | + return 'Bearer '.$this->accessToken->getAccessToken(); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | } |