@@ -83,7 +83,7 @@ |
||
83 | 83 | */ |
84 | 84 | public function has(string $key): bool |
85 | 85 | { |
86 | - return (bool) $this->get($key); |
|
86 | + return (bool)$this->get($key); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | public function offsetExists(mixed $offset): bool |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | protected function getAuthUrl(): string |
36 | 36 | { |
37 | - return $this->buildAuthUrlFromBase($this->baseUrl . '/oauth/' . $this->version . '/authorize'); |
|
37 | + return $this->buildAuthUrlFromBase($this->baseUrl.'/oauth/'.$this->version.'/authorize'); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | protected function getCodeFields(): array |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | protected function getTokenUrl(): string |
52 | 52 | { |
53 | - return $this->baseUrl . '/oauth/' . $this->version . '/token'; |
|
53 | + return $this->baseUrl.'/oauth/'.$this->version.'/token'; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | #[ArrayShape([ |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | protected function getUserByToken(string $token): array |
71 | 71 | { |
72 | 72 | $response = $this->getHttpClient()->get( |
73 | - $this->baseUrl . '/rest/' . $this->version . '/passport/users/getInfo', |
|
73 | + $this->baseUrl.'/rest/'.$this->version.'/passport/users/getInfo', |
|
74 | 74 | [ |
75 | 75 | 'query' => [ |
76 | 76 | 'access_token' => $token, |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | 'nickname' => $user['realname'] ?? null, |
94 | 94 | 'name' => $user['username'] ?? null, |
95 | 95 | 'email' => '', |
96 | - 'avatar' => $user['portrait'] ? 'http://tb.himg.baidu.com/sys/portraitn/item/' . $user['portrait'] : null, |
|
96 | + 'avatar' => $user['portrait'] ? 'http://tb.himg.baidu.com/sys/portraitn/item/'.$user['portrait'] : null, |
|
97 | 97 | ] |
98 | 98 | ); |
99 | 99 | } |
@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | |
21 | 21 | protected function getAuthUrl(): string |
22 | 22 | { |
23 | - return $this->buildAuthUrlFromBase('https://www.facebook.com/' . $this->version . '/dialog/oauth'); |
|
23 | + return $this->buildAuthUrlFromBase('https://www.facebook.com/'.$this->version.'/dialog/oauth'); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | protected function getTokenUrl(): string |
27 | 27 | { |
28 | - return $this->graphUrl . '/oauth/access_token'; |
|
28 | + return $this->graphUrl.'/oauth/access_token'; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | protected function getUserByToken(string $token, ?array $query = []): array |
51 | 51 | { |
52 | 52 | $appSecretProof = hash_hmac('sha256', $token, $this->getConfig()->get('client_secret')); |
53 | - $endpoint = $this->graphUrl . '/' . $this->version . '/me?access_token=' . $token . '&appsecret_proof=' . $appSecretProof . '&fields=' . |
|
53 | + $endpoint = $this->graphUrl.'/'.$this->version.'/me?access_token='.$token.'&appsecret_proof='.$appSecretProof.'&fields='. |
|
54 | 54 | implode(',', $this->fields); |
55 | 55 | |
56 | 56 | $response = $this->getHttpClient()->get( |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | protected function mapUserToObject(array $user): UserInterface |
70 | 70 | { |
71 | 71 | $userId = $user['id'] ?? null; |
72 | - $avatarUrl = $this->graphUrl . '/' . $this->version . '/' . $userId . '/picture'; |
|
72 | + $avatarUrl = $this->graphUrl.'/'.$this->version.'/'.$userId.'/picture'; |
|
73 | 73 | |
74 | 74 | $firstName = $user['first_name'] ?? null; |
75 | 75 | $lastName = $user['last_name'] ?? null; |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | [ |
79 | 79 | 'id' => $user['id'] ?? null, |
80 | 80 | 'nickname' => null, |
81 | - 'name' => $firstName . ' ' . $lastName, |
|
81 | + 'name' => $firstName.' '.$lastName, |
|
82 | 82 | 'email' => $user['email'] ?? null, |
83 | - 'avatar' => $userId ? $avatarUrl . '?type=normal' : null, |
|
84 | - 'avatar_original' => $userId ? $avatarUrl . '?width=1920' : null, |
|
83 | + 'avatar' => $userId ? $avatarUrl.'?type=normal' : null, |
|
84 | + 'avatar_original' => $userId ? $avatarUrl.'?width=1920' : null, |
|
85 | 85 | ] |
86 | 86 | ); |
87 | 87 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | return $response['Response'] ?? []; |
141 | 141 | } |
142 | 142 | |
143 | - protected function sign(string $requestMethod, string $host, array $query, string $payload, $headers, $credential, ?string $secretKey = null): bool|string |
|
143 | + protected function sign(string $requestMethod, string $host, array $query, string $payload, $headers, $credential, ?string $secretKey = null): bool | string |
|
144 | 144 | { |
145 | 145 | $canonicalRequestString = \join( |
146 | 146 | "\n", |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | if (empty($body['UserOpenId'])) { |
185 | - throw new AuthorizeFailedException('Authorize Failed: ' . json_encode($body, JSON_UNESCAPED_UNICODE), $body); |
|
185 | + throw new AuthorizeFailedException('Authorize Failed: '.json_encode($body, JSON_UNESCAPED_UNICODE), $body); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | $this->openId = $body['UserOpenId'] ?? null; |
@@ -19,17 +19,17 @@ discard block |
||
19 | 19 | |
20 | 20 | protected function getAuthUrl(): string |
21 | 21 | { |
22 | - return $this->buildAuthUrlFromBase($this->baseUrl . '/quickstart/testauth'); |
|
22 | + return $this->buildAuthUrlFromBase($this->baseUrl.'/quickstart/testauth'); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | protected function getTokenUrl(): string |
26 | 26 | { |
27 | - return $this->baseUrl . '/tokens/request_token'; |
|
27 | + return $this->baseUrl.'/tokens/request_token'; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | protected function getRefreshTokenUrl(): string |
31 | 31 | { |
32 | - return $this->baseUrl . '/tokens/refresh_token'; |
|
32 | + return $this->baseUrl.'/tokens/refresh_token'; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $response = $this->getHttpClient()->post($this->getTokenUrl(), [ |
42 | 42 | 'headers' => [ |
43 | 43 | 'Accept' => 'application/json', |
44 | - 'Authorization' => 'Basic ' . \base64_encode(\sprintf('%s:%s', $this->getClientId(), $this->getClientSecret())) |
|
44 | + 'Authorization' => 'Basic '.\base64_encode(\sprintf('%s:%s', $this->getClientId(), $this->getClientSecret())) |
|
45 | 45 | ], |
46 | 46 | 'form_params' => $this->getTokenFields($code), |
47 | 47 | ]); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $response = $this->getHttpClient()->post($this->getRefreshTokenUrl(), [ |
79 | 79 | 'headers' => [ |
80 | 80 | 'Accept' => 'application/json', |
81 | - 'Authorization' => 'Basic ' . \base64_encode(\sprintf('%s:%s', $this->getClientId(), $this->getClientSecret())) |
|
81 | + 'Authorization' => 'Basic '.\base64_encode(\sprintf('%s:%s', $this->getClientId(), $this->getClientSecret())) |
|
82 | 82 | ], |
83 | 83 | 'form_params' => $this->getRefreshTokenFields($refreshToken), |
84 | 84 | ]); |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | */ |
92 | 92 | protected function getUserByToken(string $token): array |
93 | 93 | { |
94 | - $response = $this->getHttpClient()->get($this->baseUrl . '/users/info', [ |
|
94 | + $response = $this->getHttpClient()->get($this->baseUrl.'/users/info', [ |
|
95 | 95 | 'headers' => [ |
96 | 96 | 'Accept' => 'application/json', |
97 | - 'Authorization' => 'Bearer ' . $token, |
|
97 | + 'Authorization' => 'Bearer '.$token, |
|
98 | 98 | ], |
99 | 99 | ]); |
100 | 100 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | if (empty($response['data'][$this->accessTokenKey])) { |
141 | - throw new AuthorizeFailedException('Authorize Failed: ' . json_encode($response, JSON_UNESCAPED_UNICODE), $response); |
|
141 | + throw new AuthorizeFailedException('Authorize Failed: '.json_encode($response, JSON_UNESCAPED_UNICODE), $response); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | return $response + [ |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | protected function getAuthUrl(): string |
32 | 32 | { |
33 | - return $this->buildAuthUrlFromBase($this->baseUrl . '/authen/v1/index'); |
|
33 | + return $this->buildAuthUrlFromBase($this->baseUrl.'/authen/v1/index'); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | #[ArrayShape(['redirect_uri' => "mixed", 'app_id' => "null|string"])] |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | protected function getTokenUrl(): string |
46 | 46 | { |
47 | - return $this->baseUrl . '/authen/v1/access_token'; |
|
47 | + return $this->baseUrl.'/authen/v1/access_token'; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | protected function getUserByToken(string $token): array |
91 | 91 | { |
92 | 92 | $response = $this->getHttpClient()->get( |
93 | - $this->baseUrl . '/authen/v1/user_info', |
|
93 | + $this->baseUrl.'/authen/v1/user_info', |
|
94 | 94 | [ |
95 | - 'headers' => ['Content-Type' => 'application/json', 'Authorization' => 'Bearer ' . $token], |
|
95 | + 'headers' => ['Content-Type' => 'application/json', 'Authorization' => 'Bearer '.$token], |
|
96 | 96 | 'query' => array_filter( |
97 | 97 | [ |
98 | 98 | 'user_access_token' => $token, |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $response = \json_decode($response->getBody(), true) ?? []; |
105 | 105 | |
106 | 106 | if (empty($response['data'])) { |
107 | - throw new \InvalidArgumentException('You have error! ' . json_encode($response, JSON_UNESCAPED_UNICODE)); |
|
107 | + throw new \InvalidArgumentException('You have error! '.json_encode($response, JSON_UNESCAPED_UNICODE)); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | return $response['data']; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | protected function configAppAccessToken() |
160 | 160 | { |
161 | - $url = $this->baseUrl . '/auth/v3/app_access_token/'; |
|
161 | + $url = $this->baseUrl.'/auth/v3/app_access_token/'; |
|
162 | 162 | $params = [ |
163 | 163 | 'json' => [ |
164 | 164 | 'app_id' => $this->config->get('client_id'), |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | ]; |
169 | 169 | |
170 | 170 | if ($this->isInternalApp) { |
171 | - $url = $this->baseUrl . '/auth/v3/app_access_token/internal/'; |
|
171 | + $url = $this->baseUrl.'/auth/v3/app_access_token/internal/'; |
|
172 | 172 | $params = [ |
173 | 173 | 'json' => [ |
174 | 174 | 'app_id' => $this->config->get('client_id'), |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | */ |
202 | 202 | protected function configTenantAccessToken() |
203 | 203 | { |
204 | - $url = $this->baseUrl . '/auth/v3/tenant_access_token/'; |
|
204 | + $url = $this->baseUrl.'/auth/v3/tenant_access_token/'; |
|
205 | 205 | $params = [ |
206 | 206 | 'json' => [ |
207 | 207 | 'app_id' => $this->config->get('client_id'), |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | ]; |
212 | 212 | |
213 | 213 | if ($this->isInternalApp) { |
214 | - $url = $this->baseUrl . '/auth/v3/tenant_access_token/internal/'; |
|
214 | + $url = $this->baseUrl.'/auth/v3/tenant_access_token/internal/'; |
|
215 | 215 | $params = [ |
216 | 216 | 'json' => [ |
217 | 217 | 'app_id' => $this->config->get('client_id'), |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | protected function getAuthUrl(): string |
24 | 24 | { |
25 | - return $this->buildAuthUrlFromBase($this->baseUrl . '/platform/oauth/connect/'); |
|
25 | + return $this->buildAuthUrlFromBase($this->baseUrl.'/platform/oauth/connect/'); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | #[ArrayShape([ |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | protected function getTokenUrl(): string |
45 | 45 | { |
46 | - return $this->baseUrl . '/oauth/access_token/'; |
|
46 | + return $this->baseUrl.'/oauth/access_token/'; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | protected function getUserByToken(string $token): array |
95 | 95 | { |
96 | - $userUrl = $this->baseUrl . '/oauth/userinfo/'; |
|
96 | + $userUrl = $this->baseUrl.'/oauth/userinfo/'; |
|
97 | 97 | |
98 | 98 | if (empty($this->openId)) { |
99 | 99 | throw new InvalidArgumentException('please set open_id before your query.'); |