@@ -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; |
@@ -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; |
@@ -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 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | /** |
20 | 20 | * @var array 所有命令行传参 |
21 | 21 | */ |
22 | - public $allArgvs = []; |
|
22 | + public $allArgvs = [ ]; |
|
23 | 23 | |
24 | 24 | public function __construct() |
25 | 25 | { |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $this->setAllArgvs(); |
67 | 67 | } |
68 | 68 | |
69 | - return $this->allArgvs[$name] ?? $default; |
|
69 | + return $this->allArgvs[ $name ] ?? $default; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | foreach ($argv as $a) { // Windows默认命令行无法正确传入使用引号括住的带空格参数,换个命令行终端就好,Linux不受影响 |
82 | 82 | if (preg_match('/^-{1,2}(?P<name>\w+)(?:=([\'"]|)(?P<val>[^\n\t\v\f\r\'"]+)\2)?$/i', $a, $m)) { |
83 | - $this->allArgvs[$m['name']] = $m['val'] ?? true; |
|
83 | + $this->allArgvs[ $m[ 'name' ] ] = $m[ 'val' ] ?? true; |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 |
@@ -126,6 +126,8 @@ |
||
126 | 126 | |
127 | 127 | self::mail()->msgHTML($message, APP_PATH . '/mail'); |
128 | 128 | |
129 | - if (!self::mail()->send()) throw new MailException(self::mail()->ErrorInfo); |
|
129 | + if (!self::mail()->send()) { |
|
130 | + throw new MailException(self::mail()->ErrorInfo); |
|
131 | + } |
|
130 | 132 | } |
131 | 133 | } |
@@ -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) { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * 'bg_green', 'bg_yellow', 'bg_blue', 'bg_magenta', 'bg_cyan', 'bg_light_gray', 'bg_dark_gray', 'bg_light_red', |
59 | 59 | * 'bg_light_green','bg_light_yellow', 'bg_light_blue', 'bg_light_magenta', 'bg_light_cyan', 'bg_white' |
60 | 60 | */ |
61 | - function system_log($content, array $response = [], $fileName = '') |
|
61 | + function system_log($content, array $response = [ ], $fileName = '') |
|
62 | 62 | { |
63 | 63 | try { |
64 | 64 | $path = sprintf('%s/logs/%s/', ROOT_PATH, date('Y-m')); |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | |
84 | 84 | // 在 Github Actions 上运行,过滤敏感信息 |
85 | 85 | if (env('ON_GITHUB_ACTIONS')) { |
86 | - $msg = preg_replace_callback('/(?P<secret>[\w-.]{1,4}?)(?=@[\w-.]+)/i', function ($m) { |
|
87 | - return str_ireplace($m['secret'], str_repeat('*', strlen($m['secret'])), $m['secret']); |
|
86 | + $msg = preg_replace_callback('/(?P<secret>[\w-.]{1,4}?)(?=@[\w-.]+)/i', function($m) { |
|
87 | + return str_ireplace($m[ 'secret' ], str_repeat('*', strlen($m[ 'secret' ])), $m[ 'secret' ]); |
|
88 | 88 | }, $msg); |
89 | 89 | } |
90 | 90 |