@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @return bool |
| 56 | 56 | * @throws \Exception |
| 57 | 57 | */ |
| 58 | - public static function debug($message, array $context = []) |
|
| 58 | + public static function debug($message, array $context = [ ]) |
|
| 59 | 59 | { |
| 60 | 60 | return self::logger()->addDebug($message, $context); |
| 61 | 61 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * @return bool |
| 68 | 68 | * @throws \Exception |
| 69 | 69 | */ |
| 70 | - public static function info($message, array $context = []) |
|
| 70 | + public static function info($message, array $context = [ ]) |
|
| 71 | 71 | { |
| 72 | 72 | return self::logger()->addInfo($message, $context); |
| 73 | 73 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * @return bool |
| 80 | 80 | * @throws \Exception |
| 81 | 81 | */ |
| 82 | - public static function notice($message, array $context = []) |
|
| 82 | + public static function notice($message, array $context = [ ]) |
|
| 83 | 83 | { |
| 84 | 84 | return self::logger()->addNotice($message, $context); |
| 85 | 85 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * @return bool |
| 92 | 92 | * @throws \Exception |
| 93 | 93 | */ |
| 94 | - public static function warning($message, array $context = []) |
|
| 94 | + public static function warning($message, array $context = [ ]) |
|
| 95 | 95 | { |
| 96 | 96 | return self::logger()->addWarning($message, $context); |
| 97 | 97 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * @return bool |
| 104 | 104 | * @throws \Exception |
| 105 | 105 | */ |
| 106 | - public static function error($message, array $context = []) |
|
| 106 | + public static function error($message, array $context = [ ]) |
|
| 107 | 107 | { |
| 108 | 108 | return self::logger()->addError($message, $context); |
| 109 | 109 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * @return bool |
| 116 | 116 | * @throws \Exception |
| 117 | 117 | */ |
| 118 | - public static function alert($message, array $context = []) |
|
| 118 | + public static function alert($message, array $context = [ ]) |
|
| 119 | 119 | { |
| 120 | 120 | return self::logger()->addAlert($message, $context); |
| 121 | 121 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | * @return bool |
| 128 | 128 | * @throws \Exception |
| 129 | 129 | */ |
| 130 | - public static function emergency($message, array $context = []) |
|
| 130 | + public static function emergency($message, array $context = [ ]) |
|
| 131 | 131 | { |
| 132 | 132 | return self::logger()->addEmergency($message, $context); |
| 133 | 133 | } |
@@ -40,17 +40,17 @@ |
||
| 40 | 40 | $keys = explode('.', $key); |
| 41 | 41 | $val = $lang; |
| 42 | 42 | foreach ($keys as $k) { |
| 43 | - if (!isset($val[$k])) { |
|
| 43 | + if (!isset($val[ $k ])) { |
|
| 44 | 44 | return null; // 任一下标不存在就返回null |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - $val = $val[$k]; |
|
| 47 | + $val = $val[ $k ]; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | return $val; |
| 51 | 51 | } else { |
| 52 | - if (isset($lang[$key])) { |
|
| 53 | - return $lang[$key]; |
|
| 52 | + if (isset($lang[ $key ])) { |
|
| 53 | + return $lang[ $key ]; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | return null; |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | /** |
| 20 | 20 | * @var array 所有命令行传参 |
| 21 | 21 | */ |
| 22 | - public $allArgvs = []; |
|
| 22 | + public $allArgvs = [ ]; |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * @return Argv |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $this->setAllArgvs(); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - return $this->allArgvs[$name] ?? $default; |
|
| 50 | + return $this->allArgvs[ $name ] ?? $default; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | foreach ($argv as $a) { // Windows默认命令行无法正确传入使用引号括住的带空格参数,换个命令行终端就好,Linux不受影响 |
| 63 | 63 | if (preg_match('/^-{1,2}(?P<name>\w+)(?:=([\'"]|)(?P<val>[^\n\t\v\f\r\'"]+)\2)?$/i', $a, $m)) { |
| 64 | - $this->allArgvs[$m['name']] = $m['val'] ?? true; |
|
| 64 | + $this->allArgvs[ $m[ 'name' ] ] = $m[ 'val' ] ?? true; |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | return null; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - if (($valueLength = strlen($value)) > 1 && $value[0] === '"' && $value[$valueLength - 1] === '"') { // 去除双引号 |
|
| 66 | + if (($valueLength = strlen($value)) > 1 && $value[ 0 ] === '"' && $value[ $valueLength - 1 ] === '"') { // 去除双引号 |
|
| 67 | 67 | return substr($value, 1, -1); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -43,17 +43,17 @@ |
||
| 43 | 43 | $keys = explode('.', $key); |
| 44 | 44 | $val = $allConfig; |
| 45 | 45 | foreach ($keys as $k) { |
| 46 | - if (!isset($val[$k])) { |
|
| 46 | + if (!isset($val[ $k ])) { |
|
| 47 | 47 | return $default; // 任一下标不存在就返回默认值 |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - $val = $val[$k]; |
|
| 50 | + $val = $val[ $k ]; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | return $val; |
| 54 | 54 | } else { |
| 55 | - if (isset($allConfig[$key])) { |
|
| 56 | - return $allConfig[$key]; |
|
| 55 | + if (isset($allConfig[ $key ])) { |
|
| 56 | + return $allConfig[ $key ]; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | return $default; |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | * 'bg_green', 'bg_yellow', 'bg_blue', 'bg_magenta', 'bg_cyan', 'bg_light_gray', 'bg_dark_gray', 'bg_light_red', |
| 58 | 58 | * 'bg_light_green','bg_light_yellow', 'bg_light_blue', 'bg_light_magenta', 'bg_light_cyan', 'bg_white' |
| 59 | 59 | */ |
| 60 | - function system_log($content, array $response = [], $fileName = '') |
|
| 60 | + function system_log($content, array $response = [ ], $fileName = '') |
|
| 61 | 61 | { |
| 62 | 62 | try { |
| 63 | 63 | $path = sprintf('%s/logs/%s/', ROOT_PATH, date('Y-m')); |
@@ -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( |