@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function login(string $user, string $password) |
| 72 | 72 | { |
| 73 | - $res = $this->guzzleClient->post($this->clientConfig->getLoginUrl() . 'services/oauth2/token', [ |
|
| 73 | + $res = $this->guzzleClient->post($this->clientConfig->getLoginUrl().'services/oauth2/token', [ |
|
| 74 | 74 | 'headers' => ['Accept' => 'application/json'], |
| 75 | 75 | 'form_params' => [ |
| 76 | 76 | 'client_id' => $this->clientConfig->getClientId(), |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | 'password' => $password, |
| 81 | 81 | ], |
| 82 | 82 | ]); |
| 83 | - if (!$this->isSuccessful($res)) { |
|
| 83 | + if ( ! $this->isSuccessful($res)) { |
|
| 84 | 84 | throw new RequestException("Can't login", (string)$res->getBody()); |
| 85 | 85 | } |
| 86 | 86 | $tokeGenerator = new AccessTokenGenerator(); |
@@ -102,10 +102,10 @@ discard block |
||
| 102 | 102 | public function getRecord($objectType, $sfId, array $fields = []) |
| 103 | 103 | { |
| 104 | 104 | $fieldsQuery = ''; |
| 105 | - if (!empty($fields)) { |
|
| 106 | - $fieldsQuery = '?fields=' . implode(',', $fields); |
|
| 105 | + if ( ! empty($fields)) { |
|
| 106 | + $fieldsQuery = '?fields='.implode(',', $fields); |
|
| 107 | 107 | } |
| 108 | - $url = $this->generateUrl('sobjects/'. $objectType . '/' . $sfId . $fieldsQuery); |
|
| 108 | + $url = $this->generateUrl('sobjects/'.$objectType.'/'.$sfId.$fieldsQuery); |
|
| 109 | 109 | $response = $this->makeRequest('get', $url, ['headers' => ['Authorization' => $this->getAuthHeader()]]); |
| 110 | 110 | |
| 111 | 111 | return json_decode($response->getBody(), true); |
@@ -123,9 +123,9 @@ discard block |
||
| 123 | 123 | public function search($query = null, $next_url = null) |
| 124 | 124 | { |
| 125 | 125 | if ( ! empty($next_url)) { |
| 126 | - $url = $this->baseUrl . '/' . $next_url; |
|
| 126 | + $url = $this->baseUrl.'/'.$next_url; |
|
| 127 | 127 | } else { |
| 128 | - $url = $this->generateUrl('query/?q=' . urlencode($query)); |
|
| 128 | + $url = $this->generateUrl('query/?q='.urlencode($query)); |
|
| 129 | 129 | } |
| 130 | 130 | $response = $this->makeRequest('get', $url, ['headers' => ['Authorization' => $this->getAuthHeader()]]); |
| 131 | 131 | $data = json_decode($response->getBody(), true); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | public function updateRecord($object, $id, array $data) |
| 155 | 155 | { |
| 156 | - $url = $this->generateUrl('sobjects/'. $object . '/' . $id); |
|
| 156 | + $url = $this->generateUrl('sobjects/'.$object.'/'.$id); |
|
| 157 | 157 | |
| 158 | 158 | $this->makeRequest('patch', $url, [ |
| 159 | 159 | 'headers' => ['Content-Type' => 'application/json', 'Authorization' => $this->getAuthHeader()], |
@@ -173,9 +173,9 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | public function createRecord($object, $data) |
| 175 | 175 | { |
| 176 | - $url = $this->generateUrl('sobjects/'. $object); |
|
| 176 | + $url = $this->generateUrl('sobjects/'.$object); |
|
| 177 | 177 | |
| 178 | - $response = $this->makeRequest('post', $url, [ |
|
| 178 | + $response = $this->makeRequest('post', $url, [ |
|
| 179 | 179 | 'headers' => ['Content-Type' => 'application/json', 'Authorization' => $this->getAuthHeader()], |
| 180 | 180 | 'body' => json_encode($data) |
| 181 | 181 | ]); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | public function deleteRecord($object, $id) |
| 196 | 196 | { |
| 197 | - $url = $this->generateUrl('sobjects/'. $object . '/' . $id); |
|
| 197 | + $url = $this->generateUrl('sobjects/'.$object.'/'.$id); |
|
| 198 | 198 | |
| 199 | 199 | $this->makeRequest('delete', $url, ['headers' => ['Authorization' => $this->getAuthHeader()]]); |
| 200 | 200 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | */ |
| 212 | 212 | public function authorizeConfirm($code, $redirect_url) |
| 213 | 213 | { |
| 214 | - $url = $this->clientConfig->getLoginUrl() . 'services/oauth2/token'; |
|
| 214 | + $url = $this->clientConfig->getLoginUrl().'services/oauth2/token'; |
|
| 215 | 215 | |
| 216 | 216 | $post_data = [ |
| 217 | 217 | 'grant_type' => 'authorization_code', |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | 'grant_type' => 'authorization_code' |
| 242 | 242 | ]; |
| 243 | 243 | |
| 244 | - return $this->clientConfig->getLoginUrl() . 'services/oauth2/authorize?' . http_build_query($params); |
|
| 244 | + return $this->clientConfig->getLoginUrl().'services/oauth2/authorize?'.http_build_query($params); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | /** |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | */ |
| 253 | 253 | public function refreshToken() |
| 254 | 254 | { |
| 255 | - $url = $this->clientConfig->getLoginUrl() . 'services/oauth2/token'; |
|
| 255 | + $url = $this->clientConfig->getLoginUrl().'services/oauth2/token'; |
|
| 256 | 256 | |
| 257 | 257 | $post_data = [ |
| 258 | 258 | 'grant_type' => 'refresh_token', |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | throw new AuthenticationException(0, "Access token not set"); |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - return 'Bearer ' . $this->accessToken->getAccessToken(); |
|
| 321 | + return 'Bearer '.$this->accessToken->getAccessToken(); |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | /** |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | */ |
| 341 | 341 | private function generateUrl($append) |
| 342 | 342 | { |
| 343 | - return $this->baseUrl . '/services/data/'.$this->clientConfig->getVersion().'/'.$append; |
|
| 343 | + return $this->baseUrl.'/services/data/'.$this->clientConfig->getVersion().'/'.$append; |
|
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | } |