@@ -124,7 +124,7 @@ public function getAuthorizationURL() : string
124
124
* Make this call by passing in the code present when the account owner is redirected back to you.
125
125
* The response will contain an 'access_token' and 'refresh_token'
126
126
*
127
- * @param string $code - Authorization Code
127
+ * @param string $code - Authorization Code
128
128
*/
129
129
public function acquireAccessToken (string $ code ) : bool
130
130
{
@@ -144,9 +144,9 @@ public function acquireAccessToken(string $code) : bool
144
144
}
145
145
146
146
/**
147
- * Refresh the access token.
148
- *
149
- * @return string new access token or 'Error' for error
147
+ * Refresh the access token.
148
+ *
149
+ * @return string new access token or 'Error' for error
150
150
*/
151
151
public function refreshToken () : string
152
152
{
@@ -184,7 +184,7 @@ public function put(string $url, array $parameters, string $method = 'PUT') : ar
184
184
'Host ' => $ this ->host ,
185
185
'Accept ' => '*/* ' ]),
186
186
'body ' => $ json , ]);
187
- ;
187
+
188
188
$ response = $ guzzle ->request ($ method , $ url );
189
189
190
190
return $ this ->process ($ response );
@@ -224,8 +224,13 @@ public function get(string $url, array $parameters) : array
224
224
{
225
225
if ($ parameters )
226
226
{
227
- $ paramString = urldecode (http_build_query ($ parameters ));
228
- $ url .= $ url . '& ' . urlencode (preg_replace ('/\[[0-9]\]/ ' , '' , $ paramString ));
227
+ $ paramString = \urldecode (\http_build_query ($ parameters ));
228
+ $ paramString = \urlencode (\preg_replace ('/\[[0-9]\]/ ' , '' , $ paramString ));
229
+
230
+ if ($ paramString )
231
+ {
232
+ $ url .= '& ' . $ paramString ;
233
+ }
229
234
}
230
235
231
236
$ guzzle = new \GuzzleHttp \Client (['headers ' => $ this ->getHeaders ()]);
@@ -248,7 +253,7 @@ public function post(string $url, array $parameters) : array
248
253
{
249
254
$ json = \json_encode ($ parameters ['body ' ], JSON_PRETTY_PRINT );
250
255
$ guzzle = new \GuzzleHttp \Client (['headers ' => $ this ->getHeaders (),
251
- 'body ' => $ json , ]);
256
+ 'body ' => $ json , ]);
252
257
$ response = $ guzzle ->request ('POST ' , $ url );
253
258
254
259
return $ this ->process ($ response );
@@ -309,7 +314,7 @@ private function getHeaders(array $additional = []) : array
309
314
'Authorization ' => 'Bearer ' . $ this ->accessToken ,
310
315
'Content-Type ' => 'application/json ' ,
311
316
'Accept ' => 'application/json ' ,
312
- ], $ additional );
317
+ ], $ additional );
313
318
}
314
319
315
320
private function process (\GuzzleHttp \Psr7 \Response $ response ) : array
0 commit comments