@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | { |
| 243 | 243 | $query = $this->getCodeFields() + ($this->state ? ['state' => $this->state] : []); |
| 244 | 244 | |
| 245 | - return $url . '?' . \http_build_query($query, '', '&', $this->encodingType); |
|
| 245 | + return $url.'?'.\http_build_query($query, '', '&', $this->encodingType); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | protected function getCodeFields(): array |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | if (empty($response[$this->accessTokenKey])) { |
| 286 | - throw new AuthorizeFailedException('Authorize Failed: ' . json_encode($response, JSON_UNESCAPED_UNICODE), $response); |
|
| 286 | + throw new AuthorizeFailedException('Authorize Failed: '.json_encode($response, JSON_UNESCAPED_UNICODE), $response); |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | return $response + [ |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $response = json_decode($response->getBody()->getContents(), true); |
| 54 | 54 | |
| 55 | 55 | if (!empty($response['error_response']) || empty($response['alipay_user_info_share_response'])) { |
| 56 | - throw new \InvalidArgumentException('You have error! ' . \json_encode($response, JSON_UNESCAPED_UNICODE)); |
|
| 56 | + throw new \InvalidArgumentException('You have error! '.\json_encode($response, JSON_UNESCAPED_UNICODE)); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | return $response['alipay_user_info_share_response']; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $response = json_decode($response->getBody()->getContents(), true); |
| 97 | 97 | |
| 98 | 98 | if (!empty($response['error_response'])) { |
| 99 | - throw new \InvalidArgumentException('You have error! ' . json_encode($response, JSON_UNESCAPED_UNICODE)); |
|
| 99 | + throw new \InvalidArgumentException('You have error! '.json_encode($response, JSON_UNESCAPED_UNICODE)); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | return $this->normalizeAccessTokenResponse($response['alipay_system_oauth_token_response']); |
@@ -188,8 +188,8 @@ discard block |
||
| 188 | 188 | throw new InvalidArgumentException('no RSA private key set.'); |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - $key = "-----BEGIN RSA PRIVATE KEY-----\n" . |
|
| 192 | - chunk_split($key, 64, "\n") . |
|
| 191 | + $key = "-----BEGIN RSA PRIVATE KEY-----\n". |
|
| 192 | + chunk_split($key, 64, "\n"). |
|
| 193 | 193 | "-----END RSA PRIVATE KEY-----"; |
| 194 | 194 | |
| 195 | 195 | openssl_sign($signContent, $signValue, $key, OPENSSL_ALGO_SHA256); |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | if (in_array($k, $except)) { |
| 212 | 212 | continue; |
| 213 | 213 | } |
| 214 | - $param_str .= $k . '='; |
|
| 214 | + $param_str .= $k.'='; |
|
| 215 | 215 | $param_str .= $urlencode ? rawurlencode($v) : $v; |
| 216 | 216 | $param_str .= '&'; |
| 217 | 217 | } |
@@ -14,6 +14,6 @@ |
||
| 14 | 14 | { |
| 15 | 15 | parent::__construct($message, -1); |
| 16 | 16 | |
| 17 | - $this->body = (array) $body; |
|
| 17 | + $this->body = (array)$body; |
|
| 18 | 18 | } |
| 19 | 19 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | ]; |
| 105 | 105 | |
| 106 | 106 | $response = $this->getHttpClient()->post( |
| 107 | - $this->getUserByCode . '?' . http_build_query($queryParams), |
|
| 107 | + $this->getUserByCode.'?'.http_build_query($queryParams), |
|
| 108 | 108 | [ |
| 109 | 109 | 'json' => ['tmp_auth_code' => $code], |
| 110 | 110 | ] |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $response = \json_decode($response->getBody()->getContents(), true); |
| 113 | 113 | |
| 114 | 114 | if (0 != $response['errcode'] ?? 1) { |
| 115 | - throw new \InvalidArgumentException('You get error: ' . json_encode($response, JSON_UNESCAPED_UNICODE)); |
|
| 115 | + throw new \InvalidArgumentException('You get error: '.json_encode($response, JSON_UNESCAPED_UNICODE)); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | return new User( |
@@ -100,11 +100,11 @@ |
||
| 100 | 100 | $name = $firstName.' '.$lastName; |
| 101 | 101 | |
| 102 | 102 | $images = $user['profilePicture.displayImage~.elements'] ?? []; |
| 103 | - $avatars = array_filter($images, function ($image) { |
|
| 103 | + $avatars = array_filter($images, function($image) { |
|
| 104 | 104 | return ($image['data']['com.linkedin.digitalmedia.mediaartifact.StillImage']['storageSize']['width'] ?? 0) === 100; |
| 105 | 105 | }); |
| 106 | 106 | $avatar = array_shift($avatars); |
| 107 | - $originalAvatars = array_filter($images, function ($image) { |
|
| 107 | + $originalAvatars = array_filter($images, function($image) { |
|
| 108 | 108 | return ($image['data']['com.linkedin.digitalmedia.mediaartifact.StillImage']['storageSize']['width'] ?? 0) === 800; |
| 109 | 109 | }); |
| 110 | 110 | $originalAvatar = array_shift($originalAvatars); |
@@ -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, |
@@ -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']; |
@@ -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 |