@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $response = \json_decode($response->getBody(), true) ?? []; |
143 | 143 | |
144 | 144 | if (($response['errcode'] ?? 1) > 0 || (empty($response['UserId']) && empty($response['OpenId']))) { |
145 | - throw new AuthorizeFailedException('Failed to get user openid:' . $response['errmsg'] ?? 'Unknown.', $response); |
|
145 | + throw new AuthorizeFailedException('Failed to get user openid:'.$response['errmsg'] ?? 'Unknown.', $response); |
|
146 | 146 | } else if (empty($response['UserId'])) { |
147 | 147 | $this->detailed = false; |
148 | 148 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $response = \json_decode($response->getBody(), true) ?? []; |
173 | 173 | |
174 | 174 | if (($response['errcode'] ?? 1) > 0 || empty($response['userid'])) { |
175 | - throw new AuthorizeFailedException('Failed to get user:' . $response['errmsg'] ?? 'Unknown.', $response); |
|
175 | + throw new AuthorizeFailedException('Failed to get user:'.$response['errmsg'] ?? 'Unknown.', $response); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | return $response; |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $response = \json_decode($response->getBody(), true) ?? []; |
226 | 226 | |
227 | 227 | if (($response['errcode'] ?? 1) > 0) { |
228 | - throw new AuthorizeFailedException('Failed to get api access_token:' . $response['errmsg'] ?? 'Unknown.', $response); |
|
228 | + throw new AuthorizeFailedException('Failed to get api access_token:'.$response['errmsg'] ?? 'Unknown.', $response); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | return $response['access_token']; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | */ |
21 | 21 | protected function getAuthUrl(): string |
22 | 22 | { |
23 | - return $this->buildAuthUrlFromBase($this->baseUrl . '/quickstart/testauth'); |
|
23 | + return $this->buildAuthUrlFromBase($this->baseUrl.'/quickstart/testauth'); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | protected function getTokenUrl(): string |
30 | 30 | { |
31 | - return $this->baseUrl . '/tokens/request_token'; |
|
31 | + return $this->baseUrl.'/tokens/request_token'; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | protected function getRefreshTokenUrl(): string |
38 | 38 | { |
39 | - return $this->baseUrl . '/tokens/refresh_token'; |
|
39 | + return $this->baseUrl.'/tokens/refresh_token'; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $response = $this->getHttpClient()->post($this->getTokenUrl(), [ |
52 | 52 | 'headers' => [ |
53 | 53 | 'Accept' => 'application/json', |
54 | - 'Authorization' => 'Basic ' . \base64_encode(\sprintf('%s:%s', $this->getClientId(), $this->getClientSecret())) |
|
54 | + 'Authorization' => 'Basic '.\base64_encode(\sprintf('%s:%s', $this->getClientId(), $this->getClientSecret())) |
|
55 | 55 | ], |
56 | 56 | 'form_params' => $this->getTokenFields($code), |
57 | 57 | ]); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $response = $this->getHttpClient()->post($this->getRefreshTokenUrl(), [ |
101 | 101 | 'headers' => [ |
102 | 102 | 'Accept' => 'application/json', |
103 | - 'Authorization' => 'Basic ' . \base64_encode(\sprintf('%s:%s', $this->getClientId(), $this->getClientSecret())) |
|
103 | + 'Authorization' => 'Basic '.\base64_encode(\sprintf('%s:%s', $this->getClientId(), $this->getClientSecret())) |
|
104 | 104 | ], |
105 | 105 | 'form_params' => $this->getRefreshTokenFields($refreshToken), |
106 | 106 | ]); |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | */ |
118 | 118 | protected function getUserByToken(string $token): array |
119 | 119 | { |
120 | - $response = $this->getHttpClient()->get($this->baseUrl . '/users/info', [ |
|
120 | + $response = $this->getHttpClient()->get($this->baseUrl.'/users/info', [ |
|
121 | 121 | 'headers' => [ |
122 | 122 | 'Accept' => 'application/json', |
123 | - 'Authorization' => 'Bearer ' . $token, |
|
123 | + 'Authorization' => 'Bearer '.$token, |
|
124 | 124 | ], |
125 | 125 | ]); |
126 | 126 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | } |
174 | 174 | |
175 | 175 | if (empty($response['data'][$this->accessTokenKey])) { |
176 | - throw new AuthorizeFailedException('Authorize Failed: ' . json_encode($response, JSON_UNESCAPED_UNICODE), $response); |
|
176 | + throw new AuthorizeFailedException('Authorize Failed: '.json_encode($response, JSON_UNESCAPED_UNICODE), $response); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | return $response + [ |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | protected function getAuthUrl(): string |
29 | 29 | { |
30 | - return $this->buildAuthUrlFromBase($this->baseUrl . '/authen/v1/index'); |
|
30 | + return $this->buildAuthUrlFromBase($this->baseUrl.'/authen/v1/index'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | protected function getCodeFields(): array |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | protected function getTokenUrl(): string |
42 | 42 | { |
43 | - return $this->baseUrl . '/authen/v1/access_token'; |
|
43 | + return $this->baseUrl.'/authen/v1/access_token'; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | protected function getUserByToken(string $token): array |
96 | 96 | { |
97 | 97 | $response = $this->getHttpClient()->get( |
98 | - $this->baseUrl . '/authen/v1/user_info', |
|
98 | + $this->baseUrl.'/authen/v1/user_info', |
|
99 | 99 | [ |
100 | - 'headers' => ['Content-Type' => 'application/json', 'Authorization' => 'Bearer ' . $token], |
|
100 | + 'headers' => ['Content-Type' => 'application/json', 'Authorization' => 'Bearer '.$token], |
|
101 | 101 | 'query' => array_filter( |
102 | 102 | [ |
103 | 103 | 'user_access_token' => $token, |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $response = \json_decode($response->getBody(), true) ?? []; |
110 | 110 | |
111 | 111 | if (empty($response['data'])) { |
112 | - throw new \InvalidArgumentException('You have error! ' . json_encode($response, JSON_UNESCAPED_UNICODE)); |
|
112 | + throw new \InvalidArgumentException('You have error! '.json_encode($response, JSON_UNESCAPED_UNICODE)); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | return $response['data']; |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | protected function configAppAccessToken() |
167 | 167 | { |
168 | - $url = $this->baseUrl . '/auth/v3/app_access_token/'; |
|
168 | + $url = $this->baseUrl.'/auth/v3/app_access_token/'; |
|
169 | 169 | $params = [ |
170 | 170 | 'json' => [ |
171 | 171 | 'app_id' => $this->config->get('client_id'), |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | ]; |
176 | 176 | |
177 | 177 | if ($this->isInternalApp) { |
178 | - $url = $this->baseUrl . '/auth/v3/app_access_token/internal/'; |
|
178 | + $url = $this->baseUrl.'/auth/v3/app_access_token/internal/'; |
|
179 | 179 | $params = [ |
180 | 180 | 'json' => [ |
181 | 181 | 'app_id' => $this->config->get('client_id'), |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | protected function configTenantAccessToken() |
207 | 207 | { |
208 | - $url = $this->baseUrl . '/auth/v3/tenant_access_token/'; |
|
208 | + $url = $this->baseUrl.'/auth/v3/tenant_access_token/'; |
|
209 | 209 | $params = [ |
210 | 210 | 'json' => [ |
211 | 211 | 'app_id' => $this->config->get('client_id'), |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | ]; |
216 | 216 | |
217 | 217 | if ($this->isInternalApp) { |
218 | - $url = $this->baseUrl . '/auth/v3/tenant_access_token/internal/'; |
|
218 | + $url = $this->baseUrl.'/auth/v3/tenant_access_token/internal/'; |
|
219 | 219 | $params = [ |
220 | 220 | 'json' => [ |
221 | 221 | 'app_id' => $this->config->get('client_id'), |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | parent::__construct($config); |
26 | 26 | |
27 | 27 | if ($this->getConfig()->has('component')) { |
28 | - $this->prepareForComponent((array) $this->getConfig()->get('component')); |
|
28 | + $this->prepareForComponent((array)$this->getConfig()->get('component')); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | { |
100 | 100 | $query = http_build_query($this->getCodeFields(), '', '&', $this->encodingType); |
101 | 101 | |
102 | - return $url . '?' . $query . '#wechat_redirect'; |
|
102 | + return $url.'?'.$query.'#wechat_redirect'; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | protected function getCodeFields(): array |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | protected function getTokenUrl(): string |
122 | 122 | { |
123 | 123 | if (!empty($this->component)) { |
124 | - return $this->baseUrl . '/oauth2/component/access_token'; |
|
124 | + return $this->baseUrl.'/oauth2/component/access_token'; |
|
125 | 125 | } |
126 | 126 | |
127 | - return $this->baseUrl . '/oauth2/access_token'; |
|
127 | + return $this->baseUrl.'/oauth2/access_token'; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | { |
160 | 160 | $language = $this->withCountryCode ? null : (isset($this->parameters['lang']) ? $this->parameters['lang'] : 'zh_CN'); |
161 | 161 | |
162 | - $response = $this->getHttpClient()->get($this->baseUrl . '/userinfo', [ |
|
162 | + $response = $this->getHttpClient()->get($this->baseUrl.'/userinfo', [ |
|
163 | 163 | 'query' => array_filter([ |
164 | 164 | 'access_token' => $token, |
165 | 165 | 'openid' => $this->openid, |