@@ -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, |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | protected function getAuthUrl(): string |
| 21 | 21 | { |
| 22 | - return $this->buildAuthUrlFromBase($this->baseUrl . '/platform/oauth/connect/'); |
|
| 22 | + return $this->buildAuthUrlFromBase($this->baseUrl.'/platform/oauth/connect/'); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function getCodeFields(): array |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | protected function getTokenUrl(): string |
| 36 | 36 | { |
| 37 | - return $this->baseUrl . '/oauth/access_token/'; |
|
| 37 | + return $this->baseUrl.'/oauth/access_token/'; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | protected function getUserByToken(string $token): array |
| 79 | 79 | { |
| 80 | - $userUrl = $this->baseUrl . '/oauth/userinfo/'; |
|
| 80 | + $userUrl = $this->baseUrl.'/oauth/userinfo/'; |
|
| 81 | 81 | |
| 82 | 82 | if (empty($this->openId)) { |
| 83 | 83 | throw new InvalidArgumentException('please set open_id before your query.'); |
@@ -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'), |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | protected function getUser(string $token, string $code): array |
| 133 | 133 | { |
| 134 | 134 | $response = $this->getHttpClient()->get( |
| 135 | - $this->baseUrl . '/cgi-bin/user/getuserinfo', |
|
| 135 | + $this->baseUrl.'/cgi-bin/user/getuserinfo', |
|
| 136 | 136 | [ |
| 137 | 137 | 'query' => array_filter( |
| 138 | 138 | [ |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $response = \json_decode($response->getBody(), true) ?? []; |
| 147 | 147 | |
| 148 | 148 | if (($response['errcode'] ?? 1) > 0 || (empty($response['UserId']) && empty($response['OpenId']))) { |
| 149 | - throw new AuthorizeFailedException('Failed to get user openid:' . $response['errmsg'] ?? 'Unknown.', $response); |
|
| 149 | + throw new AuthorizeFailedException('Failed to get user openid:'.$response['errmsg'] ?? 'Unknown.', $response); |
|
| 150 | 150 | } elseif (empty($response['UserId'])) { |
| 151 | 151 | $this->detailed = false; |
| 152 | 152 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | protected function getUserById(string $userId): array |
| 162 | 162 | { |
| 163 | 163 | $response = $this->getHttpClient()->post( |
| 164 | - $this->baseUrl . '/cgi-bin/user/get', |
|
| 164 | + $this->baseUrl.'/cgi-bin/user/get', |
|
| 165 | 165 | [ |
| 166 | 166 | 'query' => [ |
| 167 | 167 | 'access_token' => $this->getApiAccessToken(), |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | $response = \json_decode($response->getBody(), true) ?? []; |
| 174 | 174 | |
| 175 | 175 | if (($response['errcode'] ?? 1) > 0 || empty($response['userid'])) { |
| 176 | - throw new AuthorizeFailedException('Failed to get user:' . $response['errmsg'] ?? 'Unknown.', $response); |
|
| 176 | + throw new AuthorizeFailedException('Failed to get user:'.$response['errmsg'] ?? 'Unknown.', $response); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | return $response; |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | protected function requestApiAccessToken(): string |
| 213 | 213 | { |
| 214 | 214 | $response = $this->getHttpClient()->get( |
| 215 | - $this->baseUrl . '/cgi-bin/gettoken', |
|
| 215 | + $this->baseUrl.'/cgi-bin/gettoken', |
|
| 216 | 216 | [ |
| 217 | 217 | 'query' => array_filter( |
| 218 | 218 | [ |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | $response = \json_decode($response->getBody(), true) ?? []; |
| 227 | 227 | |
| 228 | 228 | if (($response['errcode'] ?? 1) > 0) { |
| 229 | - throw new AuthorizeFailedException('Failed to get api access_token:' . $response['errmsg'] ?? 'Unknown.', $response); |
|
| 229 | + throw new AuthorizeFailedException('Failed to get api access_token:'.$response['errmsg'] ?? 'Unknown.', $response); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | return $response['access_token']; |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | protected function getUser(string $token, string $code): array |
| 109 | 109 | { |
| 110 | 110 | $response = $this->getHttpClient()->get( |
| 111 | - $this->baseUrl . '/cgi-bin/service/getuserinfo3rd', |
|
| 111 | + $this->baseUrl.'/cgi-bin/service/getuserinfo3rd', |
|
| 112 | 112 | [ |
| 113 | 113 | 'query' => array_filter( |
| 114 | 114 | [ |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $response = \json_decode($response->getBody(), true) ?? []; |
| 123 | 123 | |
| 124 | 124 | if (($response['errcode'] ?? 1) > 0 || (empty($response['UserId']) && empty($response['open_userid']))) { |
| 125 | - throw new AuthorizeFailedException('Failed to get user openid:' . $response['errmsg'] ?? 'Unknown.', $response); |
|
| 125 | + throw new AuthorizeFailedException('Failed to get user openid:'.$response['errmsg'] ?? 'Unknown.', $response); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | return $response; |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | protected function getUserByTicket(string $userTicket): array |
| 139 | 139 | { |
| 140 | 140 | $response = $this->getHttpClient()->post( |
| 141 | - $this->baseUrl . '/cgi-bin/user/get', |
|
| 141 | + $this->baseUrl.'/cgi-bin/user/get', |
|
| 142 | 142 | [ |
| 143 | 143 | 'query' => [ |
| 144 | 144 | 'suite_access_token' => $this->getSuiteAccessToken(), |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $response = \json_decode($response->getBody(), true) ?? []; |
| 151 | 151 | |
| 152 | 152 | if (($response['errcode'] ?? 1) > 0 || empty($response['userid'])) { |
| 153 | - throw new AuthorizeFailedException('Failed to get user:' . $response['errmsg'] ?? 'Unknown.', $response); |
|
| 153 | + throw new AuthorizeFailedException('Failed to get user:'.$response['errmsg'] ?? 'Unknown.', $response); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | return $response; |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | protected function requestSuiteAccessToken(): string |
| 190 | 190 | { |
| 191 | 191 | $response = $this->getHttpClient()->post( |
| 192 | - $this->baseUrl . '/cgi-bin/service/get_suite_token', |
|
| 192 | + $this->baseUrl.'/cgi-bin/service/get_suite_token', |
|
| 193 | 193 | [ |
| 194 | 194 | 'json' => |
| 195 | 195 | [ |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | $response = \json_decode($response->getBody()->getContents(), true) ?? []; |
| 204 | 204 | |
| 205 | 205 | if (isset($response['errcode']) && $response['errcode'] > 0) { |
| 206 | - throw new AuthorizeFailedException('Failed to get api access_token:' . $response['errmsg'] ?? 'Unknown.', $response); |
|
| 206 | + throw new AuthorizeFailedException('Failed to get api access_token:'.$response['errmsg'] ?? 'Unknown.', $response); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | return $response['suite_access_token']; |