@@ -53,7 +53,7 @@ public function __construct(
5353 string $ clientSecret ,
5454 string $ accessToken = '' ,
5555 string $ refreshToken = '' ,
56- ?Logger $ logger = null
56+ ?Logger $ logger = null ,
5757 ) {
5858 $ this ->clientId = $ clientId ;
5959 $ this ->clientSecret = $ clientSecret ;
@@ -68,7 +68,7 @@ public function __construct(
6868 public static function createRetryMiddleware (
6969 callable $ decider ,
7070 callable $ callback ,
71- ?callable $ delay = null
71+ ?callable $ delay = null ,
7272 ): callable {
7373 return function (callable $ handler ) use ($ decider , $ callback , $ delay ) {
7474 return new RetryCallbackMiddleware ($ decider , $ callback , $ handler , $ delay );
@@ -80,7 +80,7 @@ public function createRetryDecider(int $maxRetries = 5): callable
8080 return function (
8181 $ retries ,
8282 RequestInterface $ request ,
83- ?ResponseInterface $ response = null
83+ ?ResponseInterface $ response = null ,
8484 ) use ($ maxRetries ) {
8585 $ decision = $ this ->decideRetry ($ retries , $ maxRetries , $ response );
8686 if ($ decision ) {
@@ -97,7 +97,7 @@ public function createRetryCallback(): callable
9797
9898 return function (
9999 RequestInterface $ request ,
100- ?ResponseInterface $ response = null
100+ ?ResponseInterface $ response = null ,
101101 ) use ($ api ) {
102102 if ($ response && $ response ->getStatusCode () === 401 ) {
103103 $ tokens = $ api ->refreshToken ();
@@ -114,7 +114,7 @@ protected function getClient(string $baseUri = self::API_URI): Client
114114 $ handlerStack ->push (self ::createRetryMiddleware (
115115 $ this ->createRetryDecider ($ this ->maxBackoffs ),
116116 $ this ->createRetryCallback (),
117- $ this ->delayFn
117+ $ this ->delayFn ,
118118 ));
119119
120120 return new Client ([
@@ -172,7 +172,7 @@ public function getAuthorizationUrl(
172172 string $ scope ,
173173 string $ approvalPrompt = 'force ' ,
174174 string $ accessType = 'offline ' ,
175- string $ state = ''
175+ string $ state = '' ,
176176 ): string {
177177 $ params = [
178178 'response_type=code ' ,
@@ -209,6 +209,7 @@ public function authorize(string $code, string $redirectUri): array
209209 ],
210210 ]);
211211
212+ /** @var array<string, string> $responseBody */
212213 $ responseBody = json_decode ((string ) $ response ->getBody (), true );
213214
214215 $ this ->accessToken = $ responseBody ['access_token ' ];
@@ -233,6 +234,7 @@ public function refreshToken(): array
233234 ],
234235 ]);
235236
237+ /** @var array<string, string> $responseBody */
236238 $ responseBody = json_decode ($ response ->getBody ()->getContents (), true );
237239
238240 $ this ->accessToken = $ responseBody ['access_token ' ];
@@ -251,7 +253,7 @@ public function request(
251253 string $ url ,
252254 string $ method = 'GET ' ,
253255 array $ addHeaders = [],
254- array $ options = []
256+ array $ options = [],
255257 ): Response {
256258 $ method = strtolower ($ method );
257259 if (!in_array ($ method , ['get ' , 'head ' , 'post ' , 'put ' , 'patch ' , 'delete ' , 'options ' ])) {
@@ -279,7 +281,7 @@ public function request(
279281 protected function logRetryRequest (
280282 int $ retries ,
281283 RequestInterface $ request ,
282- ?ResponseInterface $ response = null
284+ ?ResponseInterface $ response = null ,
283285 ): void {
284286 if ($ this ->logger !== null ) {
285287 $ headersForLog = $ request ->getHeaders ();
@@ -305,7 +307,7 @@ protected function logRetryRequest(
305307
306308 $ this ->logger ->info (
307309 sprintf ('Retrying request (%sx) - reason: %s ' , $ retries , $ response ->getReasonPhrase ()),
308- $ context
310+ $ context,
309311 );
310312 } else {
311313 $ this ->logger ->info (sprintf ('Retrying request (%sx) ' , $ retries ), $ context );
0 commit comments