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