@@ -124,7 +124,7 @@ public function getAuthorizationURL() : string
124124 * Make this call by passing in the code present when the account owner is redirected back to you.
125125 * The response will contain an 'access_token' and 'refresh_token'
126126 *
127- * @param string $code - Authorization Code
127+ * @param string $code - Authorization Code
128128 */
129129 public function acquireAccessToken (string $ code ) : bool
130130 {
@@ -144,9 +144,9 @@ public function acquireAccessToken(string $code) : bool
144144 }
145145
146146 /**
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
150150 */
151151 public function refreshToken () : string
152152 {
@@ -184,7 +184,7 @@ public function put(string $url, array $parameters, string $method = 'PUT') : ar
184184 'Host ' => $ this ->host ,
185185 'Accept ' => '*/* ' ]),
186186 'body ' => $ json , ]);
187- ;
187+
188188 $ response = $ guzzle ->request ($ method , $ url );
189189
190190 return $ this ->process ($ response );
@@ -224,8 +224,13 @@ public function get(string $url, array $parameters) : array
224224 {
225225 if ($ parameters )
226226 {
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+ }
229234 }
230235
231236 $ guzzle = new \GuzzleHttp \Client (['headers ' => $ this ->getHeaders ()]);
@@ -248,7 +253,7 @@ public function post(string $url, array $parameters) : array
248253 {
249254 $ json = \json_encode ($ parameters ['body ' ], JSON_PRETTY_PRINT );
250255 $ guzzle = new \GuzzleHttp \Client (['headers ' => $ this ->getHeaders (),
251- 'body ' => $ json , ]);
256+ 'body ' => $ json , ]);
252257 $ response = $ guzzle ->request ('POST ' , $ url );
253258
254259 return $ this ->process ($ response );
@@ -309,7 +314,7 @@ private function getHeaders(array $additional = []) : array
309314 'Authorization ' => 'Bearer ' . $ this ->accessToken ,
310315 'Content-Type ' => 'application/json ' ,
311316 'Accept ' => 'application/json ' ,
312- ], $ additional );
317+ ], $ additional );
313318 }
314319
315320 private function process (\GuzzleHttp \Psr7 \Response $ response ) : array
0 commit comments