Completed
Pull Request — master (#4)
by
unknown
03:19 queued 18s
created
src/AccessTokenGenerator.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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)
Please login to merge, or discard this patch.
src/TokenStore/LocalFile.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Client.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -265,8 +265,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.