@@ -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.'); |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | |
| 56 | 56 | public function has(string $key): bool |
| 57 | 57 | { |
| 58 | - return (bool) $this->get($key); |
|
| 58 | + return (bool)$this->get($key); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | public function offsetExists(mixed $offset): bool |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | protected function getAuthUrl(): string |
| 17 | 17 | { |
| 18 | - return $this->buildAuthUrlFromBase($this->getBaseUrl() . '/oauth2/v2.0/authorize'); |
|
| 18 | + return $this->buildAuthUrlFromBase($this->getBaseUrl().'/oauth2/v2.0/authorize'); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | protected function getBaseUrl(): string |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | protected function getTokenUrl(): string |
| 27 | 27 | { |
| 28 | - return $this->getBaseUrl() . '/oauth2/v2.0/token'; |
|
| 28 | + return $this->getBaseUrl().'/oauth2/v2.0/token'; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |