@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | $response = $this->getHttpClient()->get($url, [ |
56 | 56 | 'headers' => [ |
57 | - 'Authorization' => 'Bearer ' . $token, |
|
57 | + 'Authorization' => 'Bearer '.$token, |
|
58 | 58 | 'X-RestLi-Protocol-Version' => '2.0.0', |
59 | 59 | ], |
60 | 60 | ]); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | $response = $this->getHttpClient()->get($url, [ |
70 | 70 | 'headers' => [ |
71 | - 'Authorization' => 'Bearer ' . $token, |
|
71 | + 'Authorization' => 'Bearer '.$token, |
|
72 | 72 | 'X-RestLi-Protocol-Version' => '2.0.0', |
73 | 73 | ], |
74 | 74 | ]); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | protected function getUser(string $token, string $code): array |
102 | 102 | { |
103 | 103 | $responseInstance = $this->getHttpClient()->get( |
104 | - $this->baseUrl . '/cgi-bin/service/getuserinfo3rd', |
|
104 | + $this->baseUrl.'/cgi-bin/service/getuserinfo3rd', |
|
105 | 105 | [ |
106 | 106 | 'query' => \array_filter( |
107 | 107 | [ |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | protected function getUserByTicket(string $userTicket): array |
128 | 128 | { |
129 | 129 | $responseInstance = $this->getHttpClient()->post( |
130 | - $this->baseUrl . '/cgi-bin/user/get', |
|
130 | + $this->baseUrl.'/cgi-bin/user/get', |
|
131 | 131 | [ |
132 | 132 | 'query' => [ |
133 | 133 | 'suite_access_token' => $this->getSuiteAccessToken(), |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | protected function requestSuiteAccessToken(): string |
165 | 165 | { |
166 | 166 | $responseInstance = $this->getHttpClient()->post( |
167 | - $this->baseUrl . '/cgi-bin/service/get_suite_token', |
|
167 | + $this->baseUrl.'/cgi-bin/service/get_suite_token', |
|
168 | 168 | [ |
169 | 169 | 'json' => |
170 | 170 | [ |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | protected function getAuthUrl(): string |
30 | 30 | { |
31 | - return $this->buildAuthUrlFromBase($this->baseUrl . '/authorize'); |
|
31 | + return $this->buildAuthUrlFromBase($this->baseUrl.'/authorize'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | #[ArrayShape([ |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | protected function getTokenUrl(): string |
51 | 51 | { |
52 | - return $this->baseUrl . '/token'; |
|
52 | + return $this->baseUrl.'/token'; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | #[ArrayShape([ |
@@ -136,6 +136,6 @@ discard block |
||
136 | 136 | |
137 | 137 | $query = \http_build_query($this->getPublicFields($token, $apiFields), '', '&', $this->encodingType); |
138 | 138 | |
139 | - return $url . '?' . $query; |
|
139 | + return $url.'?'.$query; |
|
140 | 140 | } |
141 | 141 | } |
@@ -19,17 +19,17 @@ discard block |
||
19 | 19 | |
20 | 20 | protected function getAuthUrl(): string |
21 | 21 | { |
22 | - return $this->buildAuthUrlFromBase($this->baseUrl . '/quickstart/testauth'); |
|
22 | + return $this->buildAuthUrlFromBase($this->baseUrl.'/quickstart/testauth'); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | protected function getTokenUrl(): string |
26 | 26 | { |
27 | - return $this->baseUrl . '/tokens/request_token'; |
|
27 | + return $this->baseUrl.'/tokens/request_token'; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | protected function getRefreshTokenUrl(): string |
31 | 31 | { |
32 | - return $this->baseUrl . '/tokens/refresh_token'; |
|
32 | + return $this->baseUrl.'/tokens/refresh_token'; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | public function tokenFromCode(string $code): array |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $response = $this->getHttpClient()->post($this->getTokenUrl(), [ |
38 | 38 | 'headers' => [ |
39 | 39 | 'Accept' => 'application/json', |
40 | - 'Authorization' => 'Basic ' . \base64_encode(\sprintf('%s:%s', $this->getClientId(), $this->getClientSecret())) |
|
40 | + 'Authorization' => 'Basic '.\base64_encode(\sprintf('%s:%s', $this->getClientId(), $this->getClientSecret())) |
|
41 | 41 | ], |
42 | 42 | 'form_params' => $this->getTokenFields($code), |
43 | 43 | ]); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $response = $this->getHttpClient()->post($this->getRefreshTokenUrl(), [ |
79 | 79 | 'headers' => [ |
80 | 80 | 'Accept' => 'application/json', |
81 | - 'Authorization' => 'Basic ' . \base64_encode(\sprintf('%s:%s', $this->getClientId(), $this->getClientSecret())) |
|
81 | + 'Authorization' => 'Basic '.\base64_encode(\sprintf('%s:%s', $this->getClientId(), $this->getClientSecret())) |
|
82 | 82 | ], |
83 | 83 | 'form_params' => $this->getRefreshTokenFields($refreshToken), |
84 | 84 | ]); |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | |
89 | 89 | protected function getUserByToken(string $token): array |
90 | 90 | { |
91 | - $response = $this->getHttpClient()->get($this->baseUrl . '/users/info', [ |
|
91 | + $response = $this->getHttpClient()->get($this->baseUrl.'/users/info', [ |
|
92 | 92 | 'headers' => [ |
93 | 93 | 'Accept' => 'application/json', |
94 | - 'Authorization' => 'Bearer ' . $token, |
|
94 | + 'Authorization' => 'Bearer '.$token, |
|
95 | 95 | ], |
96 | 96 | ]); |
97 | 97 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | if (empty($response['data'][$this->accessTokenKey] ?? null)) { |
138 | - throw new Exceptions\AuthorizeFailedException('Authorize Failed: ' . \json_encode($response, JSON_UNESCAPED_UNICODE), $response); |
|
138 | + throw new Exceptions\AuthorizeFailedException('Authorize Failed: '.\json_encode($response, JSON_UNESCAPED_UNICODE), $response); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | return $response + [ |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | protected function getAuthUrl(): string |
37 | 37 | { |
38 | - return $this->buildAuthUrlFromBase($this->baseUrl . '/oauth/' . $this->version . '/authorize'); |
|
38 | + return $this->buildAuthUrlFromBase($this->baseUrl.'/oauth/'.$this->version.'/authorize'); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | protected function getCodeFields(): array |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | protected function getTokenUrl(): string |
53 | 53 | { |
54 | - return $this->baseUrl . '/oauth/' . $this->version . '/token'; |
|
54 | + return $this->baseUrl.'/oauth/'.$this->version.'/token'; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | #[ArrayShape([ |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | protected function getUserByToken(string $token): array |
72 | 72 | { |
73 | 73 | $response = $this->getHttpClient()->get( |
74 | - $this->baseUrl . '/rest/' . $this->version . '/passport/users/getInfo', |
|
74 | + $this->baseUrl.'/rest/'.$this->version.'/passport/users/getInfo', |
|
75 | 75 | [ |
76 | 76 | 'query' => [ |
77 | 77 | Contracts\RFC6749_ABNF_ACCESS_TOKEN => $token, |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | Contracts\ABNF_NICKNAME => $user['realname'] ?? null, |
94 | 94 | Contracts\ABNF_NAME => $user['username'] ?? null, |
95 | 95 | Contracts\ABNF_EMAIL => '', |
96 | - Contracts\ABNF_AVATAR => $user['portrait'] ? 'http://tb.himg.baidu.com/sys/portraitn/item/' . $user['portrait'] : null, |
|
96 | + Contracts\ABNF_AVATAR => $user['portrait'] ? 'http://tb.himg.baidu.com/sys/portraitn/item/'.$user['portrait'] : null, |
|
97 | 97 | ]); |
98 | 98 | } |
99 | 99 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | { |
33 | 33 | $response = $this->getHttpClient()->get('https://api.douban.com/v2/user/~me', [ |
34 | 34 | 'headers' => [ |
35 | - 'Authorization' => 'Bearer ' . $token, |
|
35 | + 'Authorization' => 'Bearer '.$token, |
|
36 | 36 | ], |
37 | 37 | ]); |
38 | 38 |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | |
22 | 22 | protected function getAuthUrl(): string |
23 | 23 | { |
24 | - return $this->buildAuthUrlFromBase('https://www.facebook.com/' . $this->version . '/dialog/oauth'); |
|
24 | + return $this->buildAuthUrlFromBase('https://www.facebook.com/'.$this->version.'/dialog/oauth'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | protected function getTokenUrl(): string |
28 | 28 | { |
29 | - return $this->graphUrl . '/oauth/access_token'; |
|
29 | + return $this->graphUrl.'/oauth/access_token'; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | public function tokenFromCode(string $code): array |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | { |
45 | 45 | $appSecretProof = \hash_hmac('sha256', $token, $this->getConfig()->get(Contracts\RFC6749_ABNF_CLIENT_SECRET)); |
46 | 46 | |
47 | - $response = $this->getHttpClient()->get($this->graphUrl . '/' . $this->version . '/me', [ |
|
47 | + $response = $this->getHttpClient()->get($this->graphUrl.'/'.$this->version.'/me', [ |
|
48 | 48 | 'query' => [ |
49 | 49 | Contracts\RFC6749_ABNF_ACCESS_TOKEN => $token, |
50 | 50 | 'appsecret_proof' => $appSecretProof, |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | protected function mapUserToObject(array $user): Contracts\UserInterface |
63 | 63 | { |
64 | 64 | $userId = $user[Contracts\ABNF_ID] ?? null; |
65 | - $avatarUrl = $this->graphUrl . '/' . $this->version . '/' . $userId . '/picture'; |
|
65 | + $avatarUrl = $this->graphUrl.'/'.$this->version.'/'.$userId.'/picture'; |
|
66 | 66 | |
67 | 67 | $firstName = $user['first_name'] ?? null; |
68 | 68 | $lastName = $user['last_name'] ?? null; |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | return new User([ |
71 | 71 | Contracts\ABNF_ID => $user[Contracts\ABNF_ID] ?? null, |
72 | 72 | Contracts\ABNF_NICKNAME => null, |
73 | - Contracts\ABNF_NAME => $firstName . ' ' . $lastName, |
|
73 | + Contracts\ABNF_NAME => $firstName.' '.$lastName, |
|
74 | 74 | Contracts\ABNF_EMAIL => $user[Contracts\ABNF_EMAIL] ?? null, |
75 | - Contracts\ABNF_AVATAR => $userId ? $avatarUrl . '?type=normal' : null, |
|
76 | - 'avatar_original' => $userId ? $avatarUrl . '?width=1920' : null, |
|
75 | + Contracts\ABNF_AVATAR => $userId ? $avatarUrl.'?type=normal' : null, |
|
76 | + 'avatar_original' => $userId ? $avatarUrl.'?width=1920' : null, |
|
77 | 77 | ]); |
78 | 78 | } |
79 | 79 |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | return $response['Response'] ?? []; |
133 | 133 | } |
134 | 134 | |
135 | - protected function sign(string $requestMethod, string $host, array $query, string $payload, $headers, $credential, ?string $secretKey = null): bool|string |
|
135 | + protected function sign(string $requestMethod, string $host, array $query, string $payload, $headers, $credential, ?string $secretKey = null): bool | string |
|
136 | 136 | { |
137 | 137 | $canonicalRequestString = \join( |
138 | 138 | "\n", |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | } |
175 | 175 | |
176 | 176 | if (empty($body['UserOpenId'])) { |
177 | - throw new Exceptions\AuthorizeFailedException('Authorize Failed: ' . \json_encode($body, JSON_UNESCAPED_UNICODE), $body); |
|
177 | + throw new Exceptions\AuthorizeFailedException('Authorize Failed: '.\json_encode($body, JSON_UNESCAPED_UNICODE), $body); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | $this->openId = $body['UserOpenId'] ?? null; |
@@ -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 | ); |