@@ -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')); |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | ], |
| 132 | 132 | 'cookies' => $this->jar |
| 133 | 133 | ]); |
| 134 | - $body = (string)$response->getBody(); |
|
| 134 | + $body = (string) $response->getBody(); |
|
| 135 | 135 | |
| 136 | 136 | // 域名数据 |
| 137 | 137 | if (!preg_match_all(self::DOMAIN_INFO_REGEX, $body, $domains, PREG_SET_ORDER)) { |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | if (!preg_match(self::TOKEN_REGEX, $body, $matches)) { |
| 143 | 143 | throw new LlfException(32520004); |
| 144 | 144 | } |
| 145 | - $token = $matches['token']; |
|
| 145 | + $token = $matches[ 'token' ]; |
|
| 146 | 146 | |
| 147 | 147 | // 续期 |
| 148 | 148 | $result = ''; |
@@ -150,9 +150,9 @@ discard block |
||
| 150 | 150 | $notRenewed = ''; // 记录续期出错的域名,用于邮件通知内容 |
| 151 | 151 | $domainInfo = ''; // 域名状态信息,用于邮件通知内容 |
| 152 | 152 | foreach ($domains as $d) { |
| 153 | - $domain = $d['domain']; |
|
| 154 | - $days = intval($d['days']); |
|
| 155 | - $id = $d['id']; |
|
| 153 | + $domain = $d[ 'domain' ]; |
|
| 154 | + $days = intval($d[ 'days' ]); |
|
| 155 | + $id = $d[ 'id' ]; |
|
| 156 | 156 | |
| 157 | 157 | // 免费域名只允许在到期前14天内续期 |
| 158 | 158 | if ($days <= 14) { |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | continue; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - $body = (string)$response->getBody(); |
|
| 178 | + $body = (string) $response->getBody(); |
|
| 179 | 179 | sleep(1); |
| 180 | 180 | |
| 181 | 181 | if (stripos($body, 'Order Confirmation') === false) { // 续期失败 |
@@ -226,27 +226,27 @@ discard block |
||
| 226 | 226 | * |
| 227 | 227 | * @return bool |
| 228 | 228 | */ |
| 229 | - public function arrayUnique(array &$array, array $keys = []) |
|
| 229 | + public function arrayUnique(array &$array, array $keys = [ ]) |
|
| 230 | 230 | { |
| 231 | - if (!isset($array[0]) || !is_array($array[0])) { |
|
| 231 | + if (!isset($array[ 0 ]) || !is_array($array[ 0 ])) { |
|
| 232 | 232 | return false; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | if (empty($keys)) { |
| 236 | - $keys = array_keys($array[0]); |
|
| 236 | + $keys = array_keys($array[ 0 ]); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - $tmp = []; |
|
| 239 | + $tmp = [ ]; |
|
| 240 | 240 | foreach ($array as $k => $items) { |
| 241 | 241 | $combinedKey = ''; |
| 242 | 242 | foreach ($keys as $key) { |
| 243 | - $combinedKey .= $items[$key]; |
|
| 243 | + $combinedKey .= $items[ $key ]; |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - if (isset($tmp[$combinedKey])) { |
|
| 247 | - unset($array[$k]); |
|
| 246 | + if (isset($tmp[ $combinedKey ])) { |
|
| 247 | + unset($array[ $k ]); |
|
| 248 | 248 | } else { |
| 249 | - $tmp[$combinedKey] = $k; |
|
| 249 | + $tmp[ $combinedKey ] = $k; |
|
| 250 | 250 | } |
| 251 | 251 | } |
| 252 | 252 | unset($tmp); |
@@ -262,13 +262,13 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | protected function getAccounts() |
| 264 | 264 | { |
| 265 | - $accounts = []; |
|
| 265 | + $accounts = [ ]; |
|
| 266 | 266 | $multipleAccounts = preg_replace('/\s/', '', env('MULTIPLE_ACCOUNTS')); |
| 267 | 267 | if (preg_match_all('/<(?P<u>.*?)>@<(?P<p>.*?)>/i', $multipleAccounts, $matches, PREG_SET_ORDER)) { |
| 268 | 268 | foreach ($matches as $m) { |
| 269 | - $accounts[] = [ |
|
| 270 | - 'username' => $m['u'], |
|
| 271 | - 'password' => $m['p'] |
|
| 269 | + $accounts[ ] = [ |
|
| 270 | + 'username' => $m[ 'u' ], |
|
| 271 | + 'password' => $m[ 'p' ] |
|
| 272 | 272 | ]; |
| 273 | 273 | } |
| 274 | 274 | } |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | $username = env('FREENOM_USERNAME'); |
| 277 | 277 | $password = env('FREENOM_PASSWORD'); |
| 278 | 278 | if ($username && $password) { |
| 279 | - $accounts[] = [ |
|
| 279 | + $accounts[ ] = [ |
|
| 280 | 280 | 'username' => $username, |
| 281 | 281 | 'password' => $password |
| 282 | 282 | ]; |
@@ -301,8 +301,8 @@ discard block |
||
| 301 | 301 | $accounts = $this->getAccounts(); |
| 302 | 302 | foreach ($accounts as $account) { |
| 303 | 303 | try { |
| 304 | - $this->username = $account['username']; |
|
| 305 | - $this->password = $account['password']; |
|
| 304 | + $this->username = $account[ 'username' ]; |
|
| 305 | + $this->password = $account[ 'password' ]; |
|
| 306 | 306 | $this->renewDomains(); |
| 307 | 307 | } catch (LlfException $e) { |
| 308 | 308 | Mail::send( |