@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | protected function getUser(string $token, string $code): array |
88 | 88 | { |
89 | 89 | $responseInstance = $this->getHttpClient()->get( |
90 | - $this->baseUrl . '/cgi-bin/user/getuserinfo', |
|
90 | + $this->baseUrl.'/cgi-bin/user/getuserinfo', |
|
91 | 91 | [ |
92 | 92 | 'query' => \array_filter( |
93 | 93 | [ |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | protected function getUserById(string $userId): array |
116 | 116 | { |
117 | - $responseInstance = $this->getHttpClient()->post($this->baseUrl . '/cgi-bin/user/get', [ |
|
117 | + $responseInstance = $this->getHttpClient()->post($this->baseUrl.'/cgi-bin/user/get', [ |
|
118 | 118 | 'query' => [ |
119 | 119 | Contracts\RFC6749_ABNF_ACCESS_TOKEN => $this->getApiAccessToken(), |
120 | 120 | 'userid' => $userId, |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | */ |
149 | 149 | protected function requestApiAccessToken(): string |
150 | 150 | { |
151 | - $responseInstance = $this->getHttpClient()->get($this->baseUrl . '/cgi-bin/gettoken', [ |
|
151 | + $responseInstance = $this->getHttpClient()->get($this->baseUrl.'/cgi-bin/gettoken', [ |
|
152 | 152 | 'query' => \array_filter( |
153 | 153 | [ |
154 | 154 | 'corpid' => $this->config->get('corp_id') |
@@ -62,7 +62,7 @@ |
||
62 | 62 | $response = $this->getHttpClient()->get('https://api.figma.com/v1/me', [ |
63 | 63 | 'headers' => [ |
64 | 64 | 'Accept' => 'application/json', |
65 | - 'Authorization' => 'Bearer ' . $token, |
|
65 | + 'Authorization' => 'Bearer '.$token, |
|
66 | 66 | ], |
67 | 67 | ]); |
68 | 68 |
@@ -16,17 +16,17 @@ discard block |
||
16 | 16 | |
17 | 17 | protected function getAuthUrl(): string |
18 | 18 | { |
19 | - return $this->buildAuthUrlFromBase($this->getBaseUrl() . '/oauth2/v2.0/authorize'); |
|
19 | + return $this->buildAuthUrlFromBase($this->getBaseUrl().'/oauth2/v2.0/authorize'); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | protected function getBaseUrl(): string |
23 | 23 | { |
24 | - return 'https://login.microsoftonline.com/' . $this->config['tenant']; |
|
24 | + return 'https://login.microsoftonline.com/'.$this->config['tenant']; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | protected function getTokenUrl(): string |
28 | 28 | { |
29 | - return $this->getBaseUrl() . '/oauth2/v2.0/token'; |
|
29 | + return $this->getBaseUrl().'/oauth2/v2.0/token'; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | protected function getUserByToken(string $token, ?array $query = []): array |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | 'https://graph.microsoft.com/v1.0/me', |
36 | 36 | ['headers' => [ |
37 | 37 | 'Accept' => 'application/json', |
38 | - 'Authorization' => 'Bearer ' . $token, |
|
38 | + 'Authorization' => 'Bearer '.$token, |
|
39 | 39 | ], |
40 | 40 | ] |
41 | 41 | ); |
@@ -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() |
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']); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | */ |
188 | 188 | protected function configTenantAccessToken() |
189 | 189 | { |
190 | - $url = $this->baseUrl . '/auth/v3/tenant_access_token/'; |
|
190 | + $url = $this->baseUrl.'/auth/v3/tenant_access_token/'; |
|
191 | 191 | $params = [ |
192 | 192 | 'json' => [ |
193 | 193 | Contracts\ABNF_APP_ID => $this->config->get(Contracts\RFC6749_ABNF_CLIENT_ID), |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | ]; |
198 | 198 | |
199 | 199 | if ($this->isInternalApp) { |
200 | - $url = $this->baseUrl . '/auth/v3/tenant_access_token/internal/'; |
|
200 | + $url = $this->baseUrl.'/auth/v3/tenant_access_token/internal/'; |
|
201 | 201 | $params = [ |
202 | 202 | 'json' => [ |
203 | 203 | 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): User |
@@ -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,6 +264,6 @@ discard block |
||
264 | 264 | |
265 | 265 | protected function fromJsonBody(MessageInterface $response): array |
266 | 266 | { |
267 | - return Utils::jsonDecode((string) $response->getBody(), true); |
|
267 | + return Utils::jsonDecode((string)$response->getBody(), true); |
|
268 | 268 | } |
269 | 269 | } |
@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | |
21 | 21 | protected function getAuthUrl(): string |
22 | 22 | { |
23 | - return $this->buildAuthUrlFromBase($this->baseUrl . '/oauth2/authorize'); |
|
23 | + return $this->buildAuthUrlFromBase($this->baseUrl.'/oauth2/authorize'); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | protected function getTokenUrl(): string |
27 | 27 | { |
28 | - return $this->baseUrl . '/2/oauth2/access_token'; |
|
28 | + return $this->baseUrl.'/2/oauth2/access_token'; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | #[ArrayShape([ |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | throw new Exceptions\InvalidTokenException('Invalid token.', $token); |
54 | 54 | } |
55 | 55 | |
56 | - $response = $this->getHttpClient()->get($this->baseUrl . '/2/users/show.json', [ |
|
56 | + $response = $this->getHttpClient()->get($this->baseUrl.'/2/users/show.json', [ |
|
57 | 57 | 'query' => [ |
58 | 58 | 'uid' => $uid, |
59 | 59 | Contracts\RFC6749_ABNF_ACCESS_TOKEN => $token, |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | protected function getTokenPayload(string $token): array |
73 | 73 | { |
74 | - $response = $this->getHttpClient()->post($this->baseUrl . '/oauth2/get_token_info', [ |
|
74 | + $response = $this->getHttpClient()->post($this->baseUrl.'/oauth2/get_token_info', [ |
|
75 | 75 | 'query' => [ |
76 | 76 | Contracts\RFC6749_ABNF_ACCESS_TOKEN => $token, |
77 | 77 | ], |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $response = $this->fromJsonBody($responseInstance); |
67 | 67 | |
68 | 68 | if (!empty($response['error_response'] ?? null) || empty($response['alipay_user_info_share_response'] ?? [])) { |
69 | - throw new Exceptions\BadRequestException((string) $responseInstance->getBody()); |
|
69 | + throw new Exceptions\BadRequestException((string)$responseInstance->getBody()); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | return $response['alipay_user_info_share_response'] ?? []; |
@@ -187,8 +187,8 @@ discard block |
||
187 | 187 | throw new Exceptions\InvalidArgumentException('no RSA private key set.'); |
188 | 188 | } |
189 | 189 | |
190 | - $key = "-----BEGIN RSA PRIVATE KEY-----\n" . |
|
191 | - \chunk_split($key, 64, "\n") . |
|
190 | + $key = "-----BEGIN RSA PRIVATE KEY-----\n". |
|
191 | + \chunk_split($key, 64, "\n"). |
|
192 | 192 | "-----END RSA PRIVATE KEY-----"; |
193 | 193 | |
194 | 194 | \openssl_sign($signContent, $signValue, $key, \OPENSSL_ALGO_SHA256); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | if (\in_array($k, $except)) { |
204 | 204 | continue; |
205 | 205 | } |
206 | - $param_str .= $k . '='; |
|
206 | + $param_str .= $k.'='; |
|
207 | 207 | $param_str .= $urlencode ? \rawurlencode($v) : $v; |
208 | 208 | $param_str .= '&'; |
209 | 209 | } |
@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | |
21 | 21 | protected function getAuthUrl(): string |
22 | 22 | { |
23 | - return $this->buildAuthUrlFromBase($this->baseUrl . '/oauth2.0/authorize'); |
|
23 | + return $this->buildAuthUrlFromBase($this->baseUrl.'/oauth2.0/authorize'); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | protected function getTokenUrl(): string |
27 | 27 | { |
28 | - return $this->baseUrl . '/oauth2.0/token'; |
|
28 | + return $this->baseUrl.'/oauth2.0/token'; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | #[ArrayShape([ |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | 'query' => $this->getTokenFields($code), |
47 | 47 | ]); |
48 | 48 | |
49 | - \parse_str((string) $response->getBody(), $token); |
|
49 | + \parse_str((string)$response->getBody(), $token); |
|
50 | 50 | |
51 | 51 | return $this->normalizeAccessTokenResponse($token); |
52 | 52 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | protected function getUserByToken(string $token): array |
62 | 62 | { |
63 | - $response = $this->getHttpClient()->get($this->baseUrl . '/oauth2.0/me', [ |
|
63 | + $response = $this->getHttpClient()->get($this->baseUrl.'/oauth2.0/me', [ |
|
64 | 64 | 'query' => [ |
65 | 65 | Contracts\RFC6749_ABNF_ACCESS_TOKEN => $token, |
66 | 66 | 'fmt' => 'json', |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | $me = $this->fromJsonBody($response); |
71 | 71 | |
72 | - $response = $this->getHttpClient()->get($this->baseUrl . '/user/get_user_info', [ |
|
72 | + $response = $this->getHttpClient()->get($this->baseUrl.'/user/get_user_info', [ |
|
73 | 73 | 'query' => [ |
74 | 74 | Contracts\RFC6749_ABNF_ACCESS_TOKEN => $token, |
75 | 75 | 'fmt' => 'json', |