@@ -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($offset) |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | { |
80 | 80 | $query = http_build_query($this->getCodeFields(), '', '&', $this->encodingType); |
81 | 81 | |
82 | - return $url . '?' . $query . '#wechat_redirect'; |
|
82 | + return $url.'?'.$query.'#wechat_redirect'; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | protected function getCodeFields(): array |
@@ -101,10 +101,10 @@ discard block |
||
101 | 101 | protected function getTokenUrl(): string |
102 | 102 | { |
103 | 103 | if (!empty($this->component)) { |
104 | - return $this->baseUrl . '/oauth2/component/access_token'; |
|
104 | + return $this->baseUrl.'/oauth2/component/access_token'; |
|
105 | 105 | } |
106 | 106 | |
107 | - return $this->baseUrl . '/oauth2/access_token'; |
|
107 | + return $this->baseUrl.'/oauth2/access_token'; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | { |
139 | 139 | $language = $this->withCountryCode ? null : (isset($this->parameters['lang']) ? $this->parameters['lang'] : 'zh_CN'); |
140 | 140 | |
141 | - $response = $this->getHttpClient()->get($this->baseUrl . '/userinfo', [ |
|
141 | + $response = $this->getHttpClient()->get($this->baseUrl.'/userinfo', [ |
|
142 | 142 | 'query' => array_filter([ |
143 | 143 | 'access_token' => $token, |
144 | 144 | 'openid' => $this->openid, |
@@ -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 + [ |
@@ -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 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | protected function getTokenUrl(): string |
39 | 39 | { |
40 | - return $this->baseUrl . '/oauth/access_token/'; |
|
40 | + return $this->baseUrl.'/oauth/access_token/'; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -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 InvalidArgumentException('please set open_id before your query.'); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $response = \json_decode($response->getBody(), true) ?? []; |
138 | 138 | |
139 | 139 | if (($response['errcode'] ?? 1) > 0 || empty($response['UserId'])) { |
140 | - throw new AuthorizeFailedException('Failed to get user openid:' . $response['errmsg'] ?? 'Unknown.', $response); |
|
140 | + throw new AuthorizeFailedException('Failed to get user openid:'.$response['errmsg'] ?? 'Unknown.', $response); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | return $response; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $response = \json_decode($response->getBody(), true) ?? []; |
165 | 165 | |
166 | 166 | if (($response['errcode'] ?? 1) > 0 || empty($response['userid'])) { |
167 | - throw new AuthorizeFailedException('Failed to get user:' . $response['errmsg'] ?? 'Unknown.', $response); |
|
167 | + throw new AuthorizeFailedException('Failed to get user:'.$response['errmsg'] ?? 'Unknown.', $response); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | return \json_decode($response->getBody(), true) ?? []; |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $response = \json_decode($response->getBody(), true) ?? []; |
217 | 217 | |
218 | 218 | if (($response['errcode'] ?? 1) > 0) { |
219 | - throw new AuthorizeFailedException('Failed to get api access_token:' . $response['errmsg'] ?? 'Unknown.', $response); |
|
219 | + throw new AuthorizeFailedException('Failed to get api access_token:'.$response['errmsg'] ?? 'Unknown.', $response); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | return $response['access_token']; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | protected function getAuthUrl(): string |
46 | 46 | { |
47 | - return $this->buildAuthUrlFromBase($this->baseUrl . '/oauth/' . $this->version . '/authorize'); |
|
47 | + return $this->buildAuthUrlFromBase($this->baseUrl.'/oauth/'.$this->version.'/authorize'); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | protected function getCodeFields(): array |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | protected function getTokenUrl(): string |
65 | 65 | { |
66 | - return $this->baseUrl . '/oauth/' . $this->version . '/token'; |
|
66 | + return $this->baseUrl.'/oauth/'.$this->version.'/token'; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | protected function getUserByToken(string $token): array |
85 | 85 | { |
86 | 86 | $response = $this->getHttpClient()->get( |
87 | - $this->baseUrl . '/rest/' . $this->version . '/passport/users/getInfo', |
|
87 | + $this->baseUrl.'/rest/'.$this->version.'/passport/users/getInfo', |
|
88 | 88 | [ |
89 | 89 | 'query' => [ |
90 | 90 | 'access_token' => $token, |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | 'nickname' => $user['realname'] ?? null, |
112 | 112 | 'name' => $user['username'] ?? null, |
113 | 113 | 'email' => '', |
114 | - 'avatar' => $user['portrait'] ? 'http://tb.himg.baidu.com/sys/portraitn/item/' . $user['portrait'] : null, |
|
114 | + 'avatar' => $user['portrait'] ? 'http://tb.himg.baidu.com/sys/portraitn/item/'.$user['portrait'] : null, |
|
115 | 115 | ] |
116 | 116 | ); |
117 | 117 | } |
@@ -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 | } |
@@ -188,7 +188,7 @@ |
||
188 | 188 | } |
189 | 189 | |
190 | 190 | if (empty($body['UserOpenId'])) { |
191 | - throw new AuthorizeFailedException('Authorize Failed: ' . json_encode($body, JSON_UNESCAPED_UNICODE), $body); |
|
191 | + throw new AuthorizeFailedException('Authorize Failed: '.json_encode($body, JSON_UNESCAPED_UNICODE), $body); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | $this->openId = $body['UserOpenId'] ?? null; |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | protected function getAuthUrl(): string |
18 | 18 | { |
19 | - return $this->buildAuthUrlFromBase($this->baseUrl . 'authen/v1/index'); |
|
19 | + return $this->buildAuthUrlFromBase($this->baseUrl.'authen/v1/index'); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | protected function getCodeFields(): array |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | protected function getTokenUrl(): string |
31 | 31 | { |
32 | - return $this->baseUrl . 'authen/v1/access_token'; |
|
32 | + return $this->baseUrl.'authen/v1/access_token'; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | protected function getUserByToken(string $token): array |
82 | 82 | { |
83 | 83 | $response = $this->getHttpClient()->get( |
84 | - $this->baseUrl . '/authen/v1/user_info', |
|
84 | + $this->baseUrl.'/authen/v1/user_info', |
|
85 | 85 | [ |
86 | - 'headers' => ['Content-Type' => 'application/json', 'Authorization' => 'Bearer ' . $token], |
|
86 | + 'headers' => ['Content-Type' => 'application/json', 'Authorization' => 'Bearer '.$token], |
|
87 | 87 | 'query' => array_filter( |
88 | 88 | [ |
89 | 89 | 'user_access_token' => $token, |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $response = \json_decode($response->getBody(), true) ?? []; |
96 | 96 | |
97 | 97 | if (empty($response['data'])) { |
98 | - throw new \InvalidArgumentException('You have error! ' . json_encode($response, JSON_UNESCAPED_UNICODE)); |
|
98 | + throw new \InvalidArgumentException('You have error! '.json_encode($response, JSON_UNESCAPED_UNICODE)); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | return $response['data']; |