@@ -117,8 +117,8 @@ |
||
117 | 117 | ], |
118 | 118 | ] |
119 | 119 | ); |
120 | - $rp = json_decode((string)$response->getBody(), true); |
|
120 | + $rp = json_decode((string) $response->getBody(), true); |
|
121 | 121 | |
122 | - return $rp['ok'] ?? false; |
|
122 | + return $rp[ 'ok' ] ?? false; |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | \ No newline at end of file |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | ], |
133 | 133 | 'cookies' => $this->jar |
134 | 134 | ]); |
135 | - $body = (string)$response->getBody(); |
|
135 | + $body = (string) $response->getBody(); |
|
136 | 136 | |
137 | 137 | // 域名数据 |
138 | 138 | if (!preg_match_all(self::DOMAIN_INFO_REGEX, $body, $domains, PREG_SET_ORDER)) { |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | if (!preg_match(self::TOKEN_REGEX, $body, $matches)) { |
144 | 144 | throw new LlfException(32520004); |
145 | 145 | } |
146 | - $token = $matches['token']; |
|
146 | + $token = $matches[ 'token' ]; |
|
147 | 147 | |
148 | 148 | // 续期 |
149 | 149 | $result = ''; |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | $notRenewed = $notRenewedTG = ''; // 记录续期出错的域名,用于邮件通知内容 |
152 | 152 | $domainInfo = $domainInfoTG = ''; // 域名状态信息,用于邮件通知内容 |
153 | 153 | foreach ($domains as $d) { |
154 | - $domain = $d['domain']; |
|
155 | - $days = intval($d['days']); |
|
156 | - $id = $d['id']; |
|
154 | + $domain = $d[ 'domain' ]; |
|
155 | + $days = intval($d[ 'days' ]); |
|
156 | + $id = $d[ 'id' ]; |
|
157 | 157 | |
158 | 158 | // 免费域名只允许在到期前14天内续期 |
159 | 159 | if ($days <= 14) { |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | continue; |
177 | 177 | } |
178 | 178 | |
179 | - $body = (string)$response->getBody(); |
|
179 | + $body = (string) $response->getBody(); |
|
180 | 180 | sleep(1); |
181 | 181 | |
182 | 182 | if (stripos($body, 'Order Confirmation') === false) { // 续期失败 |
@@ -238,27 +238,27 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @return bool |
240 | 240 | */ |
241 | - public function arrayUnique(array &$array, array $keys = []) |
|
241 | + public function arrayUnique(array &$array, array $keys = [ ]) |
|
242 | 242 | { |
243 | - if (!isset($array[0]) || !is_array($array[0])) { |
|
243 | + if (!isset($array[ 0 ]) || !is_array($array[ 0 ])) { |
|
244 | 244 | return false; |
245 | 245 | } |
246 | 246 | |
247 | 247 | if (empty($keys)) { |
248 | - $keys = array_keys($array[0]); |
|
248 | + $keys = array_keys($array[ 0 ]); |
|
249 | 249 | } |
250 | 250 | |
251 | - $tmp = []; |
|
251 | + $tmp = [ ]; |
|
252 | 252 | foreach ($array as $k => $items) { |
253 | 253 | $combinedKey = ''; |
254 | 254 | foreach ($keys as $key) { |
255 | - $combinedKey .= $items[$key]; |
|
255 | + $combinedKey .= $items[ $key ]; |
|
256 | 256 | } |
257 | 257 | |
258 | - if (isset($tmp[$combinedKey])) { |
|
259 | - unset($array[$k]); |
|
258 | + if (isset($tmp[ $combinedKey ])) { |
|
259 | + unset($array[ $k ]); |
|
260 | 260 | } else { |
261 | - $tmp[$combinedKey] = $k; |
|
261 | + $tmp[ $combinedKey ] = $k; |
|
262 | 262 | } |
263 | 263 | } |
264 | 264 | unset($tmp); |
@@ -274,13 +274,13 @@ discard block |
||
274 | 274 | */ |
275 | 275 | protected function getAccounts() |
276 | 276 | { |
277 | - $accounts = []; |
|
277 | + $accounts = [ ]; |
|
278 | 278 | $multipleAccounts = preg_replace('/\s/', '', env('MULTIPLE_ACCOUNTS')); |
279 | 279 | if (preg_match_all('/<(?P<u>.*?)>@<(?P<p>.*?)>/i', $multipleAccounts, $matches, PREG_SET_ORDER)) { |
280 | 280 | foreach ($matches as $m) { |
281 | - $accounts[] = [ |
|
282 | - 'username' => $m['u'], |
|
283 | - 'password' => $m['p'] |
|
281 | + $accounts[ ] = [ |
|
282 | + 'username' => $m[ 'u' ], |
|
283 | + 'password' => $m[ 'p' ] |
|
284 | 284 | ]; |
285 | 285 | } |
286 | 286 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $username = env('FREENOM_USERNAME'); |
289 | 289 | $password = env('FREENOM_PASSWORD'); |
290 | 290 | if ($username && $password) { |
291 | - $accounts[] = [ |
|
291 | + $accounts[ ] = [ |
|
292 | 292 | 'username' => $username, |
293 | 293 | 'password' => $password |
294 | 294 | ]; |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | $accounts = $this->getAccounts(); |
314 | 314 | foreach ($accounts as $account) { |
315 | 315 | try { |
316 | - $this->username = $account['username']; |
|
317 | - $this->password = $account['password']; |
|
316 | + $this->username = $account[ 'username' ]; |
|
317 | + $this->password = $account[ 'password' ]; |
|
318 | 318 | $this->renewDomains(); |
319 | 319 | } catch (LlfException $e) { |
320 | 320 | Mail::send( |