@@ -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) |
@@ -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.'); |
@@ -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; |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | |
19 | 19 | protected function getAuthUrl(): string |
20 | 20 | { |
21 | - return $this->buildAuthUrlFromBase('https://www.facebook.com/' . $this->version . '/dialog/oauth'); |
|
21 | + return $this->buildAuthUrlFromBase('https://www.facebook.com/'.$this->version.'/dialog/oauth'); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | protected function getTokenUrl(): string |
25 | 25 | { |
26 | - return $this->graphUrl . '/oauth/access_token'; |
|
26 | + return $this->graphUrl.'/oauth/access_token'; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | protected function getUserByToken(string $token, ?array $query = []): array |
56 | 56 | { |
57 | 57 | $appSecretProof = hash_hmac('sha256', $token, $this->getConfig()->get('client_secret')); |
58 | - $endpoint = $this->graphUrl . '/' . $this->version . '/me?access_token=' . $token . '&appsecret_proof=' . $appSecretProof . '&fields=' . |
|
58 | + $endpoint = $this->graphUrl.'/'.$this->version.'/me?access_token='.$token.'&appsecret_proof='.$appSecretProof.'&fields='. |
|
59 | 59 | implode(',', $this->fields); |
60 | 60 | |
61 | 61 | $response = $this->getHttpClient()->get( |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | protected function mapUserToObject(array $user): User |
74 | 74 | { |
75 | 75 | $userId = $user['id'] ?? null; |
76 | - $avatarUrl = $this->graphUrl . '/' . $this->version . '/' . $userId . '/picture'; |
|
76 | + $avatarUrl = $this->graphUrl.'/'.$this->version.'/'.$userId.'/picture'; |
|
77 | 77 | |
78 | 78 | $firstName = $user['first_name'] ?? null; |
79 | 79 | $lastName = $user['last_name'] ?? null; |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | [ |
83 | 83 | 'id' => $user['id'] ?? null, |
84 | 84 | 'nickname' => null, |
85 | - 'name' => $firstName . ' ' . $lastName, |
|
85 | + 'name' => $firstName.' '.$lastName, |
|
86 | 86 | 'email' => $user['email'] ?? null, |
87 | - 'avatar' => $userId ? $avatarUrl . '?type=normal' : null, |
|
88 | - 'avatar_original' => $userId ? $avatarUrl . '?width=1920' : null, |
|
87 | + 'avatar' => $userId ? $avatarUrl.'?type=normal' : null, |
|
88 | + 'avatar_original' => $userId ? $avatarUrl.'?width=1920' : null, |
|
89 | 89 | ] |
90 | 90 | ); |
91 | 91 | } |
@@ -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( |