@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | return $response['Response'] ?? []; |
133 | 133 | } |
134 | 134 | |
135 | - protected function sign(string $requestMethod, string $host, array $query, string $payload, array $headers, string $credential, ?string $secretKey = null): bool|string |
|
135 | + protected function sign(string $requestMethod, string $host, array $query, string $payload, array $headers, string $credential, ?string $secretKey = null): bool | string |
|
136 | 136 | { |
137 | 137 | $canonicalRequestString = \join( |
138 | 138 | "\n", |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | } |
175 | 175 | |
176 | 176 | if (empty($body['UserOpenId'] ?? null)) { |
177 | - throw new Exceptions\AuthorizeFailedException('Authorize Failed: ' . \json_encode($body, JSON_UNESCAPED_UNICODE), $body); |
|
177 | + throw new Exceptions\AuthorizeFailedException('Authorize Failed: '.\json_encode($body, JSON_UNESCAPED_UNICODE), $body); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | $this->openId = $body['UserOpenId'] ?? null; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | protected function getAuthUrl(): string |
30 | 30 | { |
31 | - return $this->buildAuthUrlFromBase($this->baseUrl . '/authen/v1/index'); |
|
31 | + return $this->buildAuthUrlFromBase($this->baseUrl.'/authen/v1/index'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | #[ArrayShape([Contracts\RFC6749_ABNF_REDIRECT_URI => 'null|string', Contracts\ABNF_APP_ID => 'null|string'])] |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | protected function getTokenUrl(): string |
44 | 44 | { |
45 | - return $this->baseUrl . '/authen/v1/access_token'; |
|
45 | + return $this->baseUrl.'/authen/v1/access_token'; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | public function tokenFromCode(string $code): array |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | */ |
78 | 78 | protected function getUserByToken(string $token): array |
79 | 79 | { |
80 | - $responseInstance = $this->getHttpClient()->get($this->baseUrl . '/authen/v1/user_info', [ |
|
80 | + $responseInstance = $this->getHttpClient()->get($this->baseUrl.'/authen/v1/user_info', [ |
|
81 | 81 | 'headers' => [ |
82 | 82 | 'Content-Type' => 'application/json', |
83 | - 'Authorization' => 'Bearer ' . $token |
|
83 | + 'Authorization' => 'Bearer '.$token |
|
84 | 84 | ], |
85 | 85 | 'query' => \array_filter( |
86 | 86 | [ |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | protected function configAppAccessToken(): self |
146 | 146 | { |
147 | - $url = $this->baseUrl . '/auth/v3/app_access_token/'; |
|
147 | + $url = $this->baseUrl.'/auth/v3/app_access_token/'; |
|
148 | 148 | $params = [ |
149 | 149 | 'json' => [ |
150 | 150 | Contracts\ABNF_APP_ID => $this->config->get(Contracts\RFC6749_ABNF_CLIENT_ID), |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | ]; |
155 | 155 | |
156 | 156 | if ($this->isInternalApp) { |
157 | - $url = $this->baseUrl . '/auth/v3/app_access_token/internal/'; |
|
157 | + $url = $this->baseUrl.'/auth/v3/app_access_token/internal/'; |
|
158 | 158 | $params = [ |
159 | 159 | 'json' => [ |
160 | 160 | Contracts\ABNF_APP_ID => $this->config->get(Contracts\RFC6749_ABNF_CLIENT_ID), |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $response = $this->fromJsonBody($responseInstance); |
172 | 172 | |
173 | 173 | if (empty($response['app_access_token'] ?? null)) { |
174 | - throw new Exceptions\InvalidTokenException('Invalid \'app_access_token\' response', (string) $responseInstance->getBody()); |
|
174 | + throw new Exceptions\InvalidTokenException('Invalid \'app_access_token\' response', (string)$responseInstance->getBody()); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | $this->config->set('app_access_token', $response['app_access_token']); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | */ |
190 | 190 | protected function configTenantAccessToken(): self |
191 | 191 | { |
192 | - $url = $this->baseUrl . '/auth/v3/tenant_access_token/'; |
|
192 | + $url = $this->baseUrl.'/auth/v3/tenant_access_token/'; |
|
193 | 193 | $params = [ |
194 | 194 | 'json' => [ |
195 | 195 | Contracts\ABNF_APP_ID => $this->config->get(Contracts\RFC6749_ABNF_CLIENT_ID), |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | ]; |
200 | 200 | |
201 | 201 | if ($this->isInternalApp) { |
202 | - $url = $this->baseUrl . '/auth/v3/tenant_access_token/internal/'; |
|
202 | + $url = $this->baseUrl.'/auth/v3/tenant_access_token/internal/'; |
|
203 | 203 | $params = [ |
204 | 204 | 'json' => [ |
205 | 205 | Contracts\ABNF_APP_ID => $this->config->get(Contracts\RFC6749_ABNF_CLIENT_ID), |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | parent::__construct($config); |
29 | 29 | |
30 | 30 | if ($this->getConfig()->has('component')) { |
31 | - $this->prepareForComponent((array) $this->getConfig()->get('component')); |
|
31 | + $this->prepareForComponent((array)$this->getConfig()->get('component')); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | { |
84 | 84 | $query = \http_build_query($this->getCodeFields(), '', '&', $this->encodingType); |
85 | 85 | |
86 | - return $url . '?' . $query . '#wechat_redirect'; |
|
86 | + return $url.'?'.$query.'#wechat_redirect'; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | protected function getCodeFields(): array |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | protected function getTokenUrl(): string |
106 | 106 | { |
107 | - return \sprintf($this->baseUrl . '/oauth2%s/access_token', empty($this->component) ? '' : '/component'); |
|
107 | + return \sprintf($this->baseUrl.'/oauth2%s/access_token', empty($this->component) ? '' : '/component'); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | public function userFromCode(string $code): Contracts\UserInterface |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | { |
129 | 129 | $language = $this->withCountryCode ? null : (isset($this->parameters['lang']) ? $this->parameters['lang'] : 'zh_CN'); |
130 | 130 | |
131 | - $response = $this->getHttpClient()->get($this->baseUrl . '/userinfo', [ |
|
131 | + $response = $this->getHttpClient()->get($this->baseUrl.'/userinfo', [ |
|
132 | 132 | 'query' => \array_filter([ |
133 | 133 | Contracts\RFC6749_ABNF_ACCESS_TOKEN => $token, |
134 | 134 | 'openid' => $this->openid, |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | { |
212 | 212 | $query = $this->getCodeFields() + ($this->state ? [Contracts\RFC6749_ABNF_STATE => $this->state] : []); |
213 | 213 | |
214 | - return $url . '?' . \http_build_query($query, '', '&', $this->encodingType); |
|
214 | + return $url.'?'.\http_build_query($query, '', '&', $this->encodingType); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | protected function getCodeFields(): array |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | { |
241 | 241 | if ($response instanceof StreamInterface) { |
242 | 242 | $response->tell() && $response->rewind(); |
243 | - $response = (string) $response; |
|
243 | + $response = (string)$response; |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | if (\is_string($response)) { |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | } |
253 | 253 | |
254 | 254 | if (empty($response[$this->accessTokenKey])) { |
255 | - throw new Exceptions\AuthorizeFailedException('Authorize Failed: ' . json_encode($response, JSON_UNESCAPED_UNICODE), $response); |
|
255 | + throw new Exceptions\AuthorizeFailedException('Authorize Failed: '.json_encode($response, JSON_UNESCAPED_UNICODE), $response); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | return $response + [ |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | |
265 | 265 | protected function fromJsonBody(MessageInterface $response): array |
266 | 266 | { |
267 | - $result = Utils::jsonDecode((string) $response->getBody(), true); |
|
267 | + $result = Utils::jsonDecode((string)$response->getBody(), true); |
|
268 | 268 | |
269 | 269 | \is_array($result) || throw new Exceptions\InvalidArgumentException('Decoded the given response payload failed.'); |
270 | 270 |