@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | ], |
| 137 | 137 | 'cookies' => $this->jar |
| 138 | 138 | ]); |
| 139 | - $body = (string)$response->getBody(); |
|
| 139 | + $body = (string) $response->getBody(); |
|
| 140 | 140 | |
| 141 | 141 | if (!preg_match(self::LOGIN_STATUS_REGEX, $body)) { |
| 142 | 142 | throw new LlfException(34520009); |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | if (!preg_match(self::TOKEN_REGEX, $body, $matches)) { |
| 152 | 152 | throw new LlfException(34520004); |
| 153 | 153 | } |
| 154 | - $token = $matches['token']; |
|
| 154 | + $token = $matches[ 'token' ]; |
|
| 155 | 155 | |
| 156 | 156 | // 续期 |
| 157 | 157 | $result = ''; |
@@ -159,9 +159,9 @@ discard block |
||
| 159 | 159 | $notRenewed = $notRenewedTG = ''; // 记录续期出错的域名,用于邮件通知内容 |
| 160 | 160 | $domainInfo = $domainInfoTG = ''; // 域名状态信息,用于邮件通知内容 |
| 161 | 161 | foreach ($domains as $d) { |
| 162 | - $domain = $d['domain']; |
|
| 163 | - $days = intval($d['days']); |
|
| 164 | - $id = $d['id']; |
|
| 162 | + $domain = $d[ 'domain' ]; |
|
| 163 | + $days = intval($d[ 'days' ]); |
|
| 164 | + $id = $d[ 'id' ]; |
|
| 165 | 165 | |
| 166 | 166 | // 免费域名只允许在到期前14天内续期 |
| 167 | 167 | if ($days <= 14) { |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | continue; |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - $body = (string)$response->getBody(); |
|
| 187 | + $body = (string) $response->getBody(); |
|
| 188 | 188 | sleep(1); |
| 189 | 189 | |
| 190 | 190 | if (stripos($body, 'Order Confirmation') === false) { // 续期失败 |
@@ -248,27 +248,27 @@ discard block |
||
| 248 | 248 | * |
| 249 | 249 | * @return bool |
| 250 | 250 | */ |
| 251 | - public function arrayUnique(array &$array, array $keys = []) |
|
| 251 | + public function arrayUnique(array &$array, array $keys = [ ]) |
|
| 252 | 252 | { |
| 253 | - if (!isset($array[0]) || !is_array($array[0])) { |
|
| 253 | + if (!isset($array[ 0 ]) || !is_array($array[ 0 ])) { |
|
| 254 | 254 | return false; |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | if (empty($keys)) { |
| 258 | - $keys = array_keys($array[0]); |
|
| 258 | + $keys = array_keys($array[ 0 ]); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - $tmp = []; |
|
| 261 | + $tmp = [ ]; |
|
| 262 | 262 | foreach ($array as $k => $items) { |
| 263 | 263 | $combinedKey = ''; |
| 264 | 264 | foreach ($keys as $key) { |
| 265 | - $combinedKey .= $items[$key]; |
|
| 265 | + $combinedKey .= $items[ $key ]; |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - if (isset($tmp[$combinedKey])) { |
|
| 269 | - unset($array[$k]); |
|
| 268 | + if (isset($tmp[ $combinedKey ])) { |
|
| 269 | + unset($array[ $k ]); |
|
| 270 | 270 | } else { |
| 271 | - $tmp[$combinedKey] = $k; |
|
| 271 | + $tmp[ $combinedKey ] = $k; |
|
| 272 | 272 | } |
| 273 | 273 | } |
| 274 | 274 | unset($tmp); |
@@ -284,13 +284,13 @@ discard block |
||
| 284 | 284 | */ |
| 285 | 285 | protected function getAccounts() |
| 286 | 286 | { |
| 287 | - $accounts = []; |
|
| 287 | + $accounts = [ ]; |
|
| 288 | 288 | $multipleAccounts = preg_replace('/\s/', '', env('MULTIPLE_ACCOUNTS')); |
| 289 | 289 | if (preg_match_all('/<(?P<u>.*?)>@<(?P<p>.*?)>/i', $multipleAccounts, $matches, PREG_SET_ORDER)) { |
| 290 | 290 | foreach ($matches as $m) { |
| 291 | - $accounts[] = [ |
|
| 292 | - 'username' => $m['u'], |
|
| 293 | - 'password' => $m['p'] |
|
| 291 | + $accounts[ ] = [ |
|
| 292 | + 'username' => $m[ 'u' ], |
|
| 293 | + 'password' => $m[ 'p' ] |
|
| 294 | 294 | ]; |
| 295 | 295 | } |
| 296 | 296 | } |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | $username = env('FREENOM_USERNAME'); |
| 299 | 299 | $password = env('FREENOM_PASSWORD'); |
| 300 | 300 | if ($username && $password) { |
| 301 | - $accounts[] = [ |
|
| 301 | + $accounts[ ] = [ |
|
| 302 | 302 | 'username' => $username, |
| 303 | 303 | 'password' => $password |
| 304 | 304 | ]; |
@@ -351,8 +351,8 @@ discard block |
||
| 351 | 351 | $accounts = $this->getAccounts(); |
| 352 | 352 | foreach ($accounts as $account) { |
| 353 | 353 | try { |
| 354 | - $this->username = $account['username']; |
|
| 355 | - $this->password = $account['password']; |
|
| 354 | + $this->username = $account[ 'username' ]; |
|
| 355 | + $this->password = $account[ 'password' ]; |
|
| 356 | 356 | |
| 357 | 357 | $this->renewDomains(); |
| 358 | 358 | } catch (LlfException $e) { |