@@ -30,7 +30,7 @@ |
||
| 30 | 30 | 'https://graph.microsoft.com/v1.0/me', |
| 31 | 31 | ['headers' => [ |
| 32 | 32 | 'Accept' => 'application/json', |
| 33 | - 'Authorization' => 'Bearer ' . $token, |
|
| 33 | + 'Authorization' => 'Bearer '.$token, |
|
| 34 | 34 | ], |
| 35 | 35 | ] |
| 36 | 36 | ); |
@@ -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 | /** |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | protected function getUserByToken(string $token): array |
| 93 | 93 | { |
| 94 | - $userUrl = $this->baseUrl . '/oauth/userinfo/'; |
|
| 94 | + $userUrl = $this->baseUrl.'/oauth/userinfo/'; |
|
| 95 | 95 | |
| 96 | 96 | if (empty($this->openId)) { |
| 97 | 97 | throw new Exceptions\InvalidArgumentException('please set the `open_id` before issue the API request.'); |
@@ -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 | ], |