@@ -40,16 +40,16 @@ discard block |
||
40 | 40 | static public function createChannelId($namespace = ''):string { |
41 | 41 | static $guid = ''; |
42 | 42 | $uid = uniqid("", true); |
43 | - $data = $namespace. md5(time() . mt_rand(1,1000000)).uniqid(); |
|
44 | - $hash = strtoupper(hash('ripemd128', $uid . $guid . md5($data))); |
|
45 | - $guid = substr($hash, 0, 8) . |
|
46 | - '-' . |
|
47 | - substr($hash, 8, 4) . |
|
48 | - '-' . |
|
49 | - substr($hash, 12, 4) . |
|
50 | - '-' . |
|
51 | - substr($hash, 16, 4) . |
|
52 | - '-' . |
|
43 | + $data = $namespace.md5(time().mt_rand(1, 1000000)).uniqid(); |
|
44 | + $hash = strtoupper(hash('ripemd128', $uid.$guid.md5($data))); |
|
45 | + $guid = substr($hash, 0, 8). |
|
46 | + '-'. |
|
47 | + substr($hash, 8, 4). |
|
48 | + '-'. |
|
49 | + substr($hash, 12, 4). |
|
50 | + '-'. |
|
51 | + substr($hash, 16, 4). |
|
52 | + '-'. |
|
53 | 53 | substr($hash, 20, 12); |
54 | 54 | return $guid; |
55 | 55 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @return string |
63 | 63 | */ |
64 | 64 | static public function md5Bit16($str):string { |
65 | - return strtoupper(substr(md5($str),8,16)); |
|
65 | + return strtoupper(substr(md5($str), 8, 16)); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -72,15 +72,15 @@ discard block |
||
72 | 72 | * @return int |
73 | 73 | */ |
74 | 74 | static public function millisecond($time = null) :int{ |
75 | - if(empty($time)){ |
|
75 | + if (empty($time)) { |
|
76 | 76 | list($msec, $sec) = explode(' ', microtime()); |
77 | - $millisecond = (int)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000); |
|
78 | - }elseif(is_numeric($time) && strlen((string)$time)==10){ |
|
79 | - $millisecond = (string)$time."000"; |
|
80 | - }else{ |
|
77 | + $millisecond = (int) sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000); |
|
78 | + }elseif (is_numeric($time) && strlen((string) $time) == 10) { |
|
79 | + $millisecond = (string) $time."000"; |
|
80 | + } else { |
|
81 | 81 | $millisecond = strtotime($time)."000"; |
82 | 82 | } |
83 | - return (int)$millisecond; |
|
83 | + return (int) $millisecond; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @param string $string |
90 | 90 | * @return bool |
91 | 91 | */ |
92 | - public static function isContainChinese($string=''):bool { |
|
92 | + public static function isContainChinese($string = ''):bool { |
|
93 | 93 | $result = preg_match('/[\x{4e00}-\x{9fa5}]/u', $string); |
94 | 94 | return $result == 0 ? false : true; |
95 | 95 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @param string $string |
101 | 101 | * @return bool |
102 | 102 | */ |
103 | - public static function isAllChinese($string=''):bool { |
|
103 | + public static function isAllChinese($string = ''):bool { |
|
104 | 104 | $result = preg_match('/^[\x{4e00}-\x{9fa5}]+$/u', $string); |
105 | 105 | return $result == 0 ? false : true; |
106 | 106 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * @param string $string |
113 | 113 | * @return bool |
114 | 114 | */ |
115 | - public static function isMobile($string=''):bool { |
|
115 | + public static function isMobile($string = ''):bool { |
|
116 | 116 | if (!preg_match("/(^1[3|4|5|7|8][0-9]{9}$)/", $string)) { |
117 | 117 | return false; |
118 | 118 | } |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | * @param int $double 小数点保留位数 默认3位 |
128 | 128 | * @return string |
129 | 129 | */ |
130 | - public static function sctonum($num, $double = 3){ |
|
131 | - if(false !== stripos($num, "e")){ |
|
132 | - $a = explode("e",strtolower($num)); |
|
130 | + public static function sctonum($num, $double = 3) { |
|
131 | + if (false !== stripos($num, "e")) { |
|
132 | + $a = explode("e", strtolower($num)); |
|
133 | 133 | return bcmul($a[0], bcpow(10, $a[1], $double), $double); |
134 | 134 | } |
135 | 135 | return $num; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @param string $to |
144 | 144 | * @return array|false|string|string[]|null |
145 | 145 | */ |
146 | - public static function autoCharset($string, $from='gbk', $to='utf-8') { |
|
146 | + public static function autoCharset($string, $from = 'gbk', $to = 'utf-8') { |
|
147 | 147 | $from = strtoupper($from) == 'UTF8' ? 'utf-8' : $from; |
148 | 148 | $to = strtoupper($to) == 'UTF8' ? 'utf-8' : $to; |
149 | 149 | if (strtoupper($from) === strtoupper($to) || empty($string) || (is_scalar($string) && !is_string($string))) { |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @param $html |
180 | 180 | * @return string |
181 | 181 | */ |
182 | - public static function filterATag($html=''):string { |
|
182 | + public static function filterATag($html = ''):string { |
|
183 | 183 | return preg_replace("#<a[^>]*>(.*?)</a>#is", "$1", $html); |
184 | 184 | } |
185 | 185 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @param $html |
191 | 191 | * @return string |
192 | 192 | */ |
193 | - public static function deleteATag($html=''):string { |
|
193 | + public static function deleteATag($html = ''):string { |
|
194 | 194 | return preg_replace("#<a[^>]*>(.*?)</a>#is", "", $html); |
195 | 195 | } |
196 | 196 | |
@@ -202,36 +202,36 @@ discard block |
||
202 | 202 | * @param bool $is_timestamp 是否是时间戳 |
203 | 203 | * @return string |
204 | 204 | */ |
205 | - public static function getTime($date,$is_timestamp=false):string { |
|
206 | - if($is_timestamp === true){ |
|
205 | + public static function getTime($date, $is_timestamp = false):string { |
|
206 | + if ($is_timestamp === true) { |
|
207 | 207 | $time = $date; |
208 | - }else{ |
|
209 | - $time = strtotime($date);//时间转换为时间戳 |
|
208 | + } else { |
|
209 | + $time = strtotime($date); //时间转换为时间戳 |
|
210 | 210 | } |
211 | 211 | |
212 | - if($time >= time()){ |
|
212 | + if ($time >= time()) { |
|
213 | 213 | return '刚刚'; |
214 | 214 | } |
215 | 215 | $seconds = time() - $time; |
216 | - if($seconds <= 60){ |
|
216 | + if ($seconds <= 60) { |
|
217 | 217 | return '刚刚'; |
218 | 218 | } |
219 | 219 | $minutes = intval($seconds / 60); |
220 | - if($minutes <= 60){ |
|
220 | + if ($minutes <= 60) { |
|
221 | 221 | return $minutes.'分钟前'; |
222 | 222 | } |
223 | 223 | $hours = intval($minutes / 60); |
224 | - if($hours <= 24){ |
|
224 | + if ($hours <= 24) { |
|
225 | 225 | return $hours.'小时前'; |
226 | 226 | } |
227 | 227 | $days = intval($hours / 24); |
228 | - if($days <= 3){ |
|
228 | + if ($days <= 3) { |
|
229 | 229 | return $days.'天前'; |
230 | 230 | } |
231 | - if($days <= 365){ |
|
232 | - return date('m-d',/** @scrutinizer ignore-type */ $time); |
|
231 | + if ($days <= 365) { |
|
232 | + return date('m-d', /** @scrutinizer ignore-type */ $time); |
|
233 | 233 | } |
234 | - return date('Y-m-d',$time); |
|
234 | + return date('Y-m-d', $time); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -245,11 +245,11 @@ discard block |
||
245 | 245 | $compress = ''; |
246 | 246 | foreach ($chunks as $c) { |
247 | 247 | if (strtolower(substr($c, 0, 19)) == '<!--<nocompress>-->') { |
248 | - $c = substr($c, 19, strlen($c) - 19 - 20); |
|
248 | + $c = substr($c, 19, strlen($c) - 19 - 20); |
|
249 | 249 | $compress .= $c; |
250 | 250 | continue; |
251 | 251 | } elseif (strtolower(substr($c, 0, 12)) == '<nocompress>') { |
252 | - $c = substr($c, 12, strlen($c) - 12 - 13); |
|
252 | + $c = substr($c, 12, strlen($c) - 12 - 13); |
|
253 | 253 | $compress .= $c; |
254 | 254 | continue; |
255 | 255 | } elseif (strtolower(substr($c, 0, 4)) == '<pre' || strtolower(substr($c, 0, 9)) == '<textarea') { |
@@ -297,14 +297,14 @@ discard block |
||
297 | 297 | * @return mixed |
298 | 298 | */ |
299 | 299 | static public function htmlReplaceXcx(string $content):string { |
300 | - $content = str_replace("\r\n","",$content);//出除回车和换行符 |
|
301 | - $content = preg_replace("/style=\".*?\"/si",'',$content);//style样式 |
|
302 | - $content = preg_replace(["/<strong.*?>/si", "/<\/strong>/si"],['<text class="wx-strong">','</text>'],$content);//strong |
|
303 | - $content = preg_replace(["/<p.*?>/si", "/<\/p>/si"],['<view class="wx-p">','</view>'],$content);//p |
|
304 | - $content = preg_replace(["/<a.*?>/si", "/<\/a>/si"],['<text class="wx-a">','</text>'],$content);//a |
|
305 | - $content = preg_replace(["/<span.*?>/si", "/<\/span>/si"],['<text class="wx-span">','</text>'],$content);//span |
|
306 | - $content = preg_replace(["/<h[1-6].*?>/si", "/<\/h[1-6]>/si"],['<view class="wx-h">','</view>'],$content);//h |
|
307 | - $content = preg_replace("/<img.*?/si",'<image class="wx-img"',$content);//img |
|
300 | + $content = str_replace("\r\n", "", $content); //出除回车和换行符 |
|
301 | + $content = preg_replace("/style=\".*?\"/si", '', $content); //style样式 |
|
302 | + $content = preg_replace(["/<strong.*?>/si", "/<\/strong>/si"], ['<text class="wx-strong">', '</text>'], $content); //strong |
|
303 | + $content = preg_replace(["/<p.*?>/si", "/<\/p>/si"], ['<view class="wx-p">', '</view>'], $content); //p |
|
304 | + $content = preg_replace(["/<a.*?>/si", "/<\/a>/si"], ['<text class="wx-a">', '</text>'], $content); //a |
|
305 | + $content = preg_replace(["/<span.*?>/si", "/<\/span>/si"], ['<text class="wx-span">', '</text>'], $content); //span |
|
306 | + $content = preg_replace(["/<h[1-6].*?>/si", "/<\/h[1-6]>/si"], ['<view class="wx-h">', '</view>'], $content); //h |
|
307 | + $content = preg_replace("/<img.*?/si", '<image class="wx-img"', $content); //img |
|
308 | 308 | return $content; |
309 | 309 | } |
310 | 310 | |
@@ -316,8 +316,8 @@ discard block |
||
316 | 316 | * @return string |
317 | 317 | */ |
318 | 318 | static public function pReplaceSpan(string $content):string { |
319 | - $content = str_replace(["\r","\n","\t"],'',$content); |
|
320 | - $content = preg_replace(["/<p/si", "/<\/p>/si"],['<span','</span><br>'],$content);//p |
|
319 | + $content = str_replace(["\r", "\n", "\t"], '', $content); |
|
320 | + $content = preg_replace(["/<p/si", "/<\/p>/si"], ['<span', '</span><br>'], $content); //p |
|
321 | 321 | return $content; |
322 | 322 | } |
323 | 323 | |
@@ -328,10 +328,10 @@ discard block |
||
328 | 328 | * @param string $keyword |
329 | 329 | * @return string |
330 | 330 | */ |
331 | - static public function filterPunctuation($keyword){ |
|
332 | - $keyword = str_replace(["\r\n", "\r", "\n"," "," "], "", trim($keyword));//删除空格 |
|
333 | - $keyword = preg_replace('# #','',$keyword); |
|
334 | - $keyword = preg_replace("/[ '.,:;*?~`!@#$%^&+=)(<>{}]|\]|\[|\/|\\\|\"|\|/",'',$keyword); |
|
331 | + static public function filterPunctuation($keyword) { |
|
332 | + $keyword = str_replace(["\r\n", "\r", "\n", " ", " "], "", trim($keyword)); //删除空格 |
|
333 | + $keyword = preg_replace('# #', '', $keyword); |
|
334 | + $keyword = preg_replace("/[ '.,:;*?~`!@#$%^&+=)(<>{}]|\]|\[|\/|\\\|\"|\|/", '', $keyword); |
|
335 | 335 | return $keyword; |
336 | 336 | } |
337 | 337 | |
@@ -343,9 +343,9 @@ discard block |
||
343 | 343 | * @param string $allowable_tags |
344 | 344 | * @return string |
345 | 345 | */ |
346 | - static public function stripTags($content,$allowable_tags = '<font>'){ |
|
347 | - $content = strip_tags($content,$allowable_tags);//替换标签 |
|
348 | - $content = str_replace(["\r\n", "\r", "\n"," "], "", trim($content));//删除空格 |
|
346 | + static public function stripTags($content, $allowable_tags = '<font>') { |
|
347 | + $content = strip_tags($content, $allowable_tags); //替换标签 |
|
348 | + $content = str_replace(["\r\n", "\r", "\n", " "], "", trim($content)); //删除空格 |
|
349 | 349 | return $content; |
350 | 350 | } |
351 | 351 |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | if(empty($time)){ |
76 | 76 | list($msec, $sec) = explode(' ', microtime()); |
77 | 77 | $millisecond = (int)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000); |
78 | - }elseif(is_numeric($time) && strlen((string)$time)==10){ |
|
78 | + } elseif(is_numeric($time) && strlen((string)$time)==10){ |
|
79 | 79 | $millisecond = (string)$time."000"; |
80 | - }else{ |
|
80 | + } else{ |
|
81 | 81 | $millisecond = strtotime($time)."000"; |
82 | 82 | } |
83 | 83 | return (int)$millisecond; |
@@ -162,12 +162,12 @@ discard block |
||
162 | 162 | foreach ($string as $key => $val) { |
163 | 163 | $_key = self::autoCharset($key, $from, $to); |
164 | 164 | $string[$_key] = self::autoCharset($val, $from, $to); |
165 | - if ($key != $_key) |
|
166 | - unset($string[$key]); |
|
165 | + if ($key != $_key) { |
|
166 | + unset($string[$key]); |
|
167 | + } |
|
167 | 168 | } |
168 | 169 | return $string; |
169 | - } |
|
170 | - else { |
|
170 | + } else { |
|
171 | 171 | return $string; |
172 | 172 | } |
173 | 173 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | public static function getTime($date,$is_timestamp=false):string { |
206 | 206 | if($is_timestamp === true){ |
207 | 207 | $time = $date; |
208 | - }else{ |
|
208 | + } else{ |
|
209 | 209 | $time = strtotime($date);//时间转换为时间戳 |
210 | 210 | } |
211 | 211 |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public $client; |
21 | 21 | |
22 | - static public function init(){ |
|
22 | + static public function init() { |
|
23 | 23 | $gateway = new self(); |
24 | 24 | |
25 | - $gateway->client = new ZipArchive(); |
|
25 | + $gateway->client = new ZipArchive(); |
|
26 | 26 | return $gateway; |
27 | 27 | } |
28 | 28 | |
@@ -33,29 +33,29 @@ discard block |
||
33 | 33 | * @author: Tinymeng <[email protected]> |
34 | 34 | * @time: 2022/4/27 9:26 |
35 | 35 | */ |
36 | - public function open($filename,$Fromfilename=null){ |
|
37 | - if (!empty($filename)){ |
|
36 | + public function open($filename, $Fromfilename = null) { |
|
37 | + if (!empty($filename)) { |
|
38 | 38 | $this->setFileName($filename); |
39 | - if(!$this->client->open($this->fileName, ZipArchive::CREATE)) |
|
39 | + if (!$this->client->open($this->fileName, ZipArchive::CREATE)) |
|
40 | 40 | return 'File open failed'; |
41 | 41 | } |
42 | - if(!empty($Fromfilename)){ |
|
43 | - if(is_dir($Fromfilename)){ |
|
42 | + if (!empty($Fromfilename)) { |
|
43 | + if (is_dir($Fromfilename)) { |
|
44 | 44 | $list_dir = scandir($Fromfilename); |
45 | - for($i=2;$i<count($list_dir);$i++){ |
|
46 | - if(is_dir($Fromfilename.'/'.$list_dir[$i])){ |
|
45 | + for ($i = 2; $i < count($list_dir); $i++) { |
|
46 | + if (is_dir($Fromfilename.'/'.$list_dir[$i])) { |
|
47 | 47 | $this->client->addGlob($Fromfilename.'/'.$list_dir[$i].'/*.*', 0, array('add_path' => $Fromfilename.'/'.$list_dir[$i].'/', 'remove_path' => $Fromfilename.'/'.$list_dir[$i])); |
48 | 48 | $list_chr = scandir($Fromfilename.'/'.$list_dir[$i]); |
49 | - for($j=2;$j<count($list_chr);$j++){ |
|
50 | - if(is_dir($Fromfilename.'/'.$list_dir[$i].'/'.$list_chr[$j])){ |
|
49 | + for ($j = 2; $j < count($list_chr); $j++) { |
|
50 | + if (is_dir($Fromfilename.'/'.$list_dir[$i].'/'.$list_chr[$j])) { |
|
51 | 51 | echo $list_chr[$j]; |
52 | - $this->open('',$Fromfilename.'/'.$list_dir[$i].'/'.$list_chr[$j]); |
|
52 | + $this->open('', $Fromfilename.'/'.$list_dir[$i].'/'.$list_chr[$j]); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
57 | - }else{ |
|
58 | - $this->client->addFile ($Fromfilename); |
|
57 | + } else { |
|
58 | + $this->client->addFile($Fromfilename); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | return $this; |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | * @author: Tinymeng <[email protected]> |
69 | 69 | * @time: 2022/4/27 9:26 |
70 | 70 | */ |
71 | - private function setFileName($filename){ |
|
72 | - if(!preg_match('/zip/m', $filename)){ |
|
73 | - $filename = $filename.'-'.date('Ymd').rand(111,999).'.zip'; |
|
71 | + private function setFileName($filename) { |
|
72 | + if (!preg_match('/zip/m', $filename)) { |
|
73 | + $filename = $filename.'-'.date('Ymd').rand(111, 999).'.zip'; |
|
74 | 74 | } |
75 | 75 | $this->fileName = $filename; |
76 | 76 | return $filename; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @author: Tinymeng <[email protected]> |
83 | 83 | * @time: 2022/4/27 9:50 |
84 | 84 | */ |
85 | - public function getFileName(){ |
|
85 | + public function getFileName() { |
|
86 | 86 | return $this->fileName; |
87 | 87 | } |
88 | 88 | |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | * @author: Tinymeng <[email protected]> |
95 | 95 | * @time: 2022/4/27 9:31 |
96 | 96 | */ |
97 | - public function addFileContent($file_name,$content){ |
|
98 | - $this->client->addFromString($file_name,$content); |
|
97 | + public function addFileContent($file_name, $content) { |
|
98 | + $this->client->addFromString($file_name, $content); |
|
99 | 99 | return $this; |
100 | 100 | } |
101 | 101 | |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | * @author: Tinymeng <[email protected]> |
108 | 108 | * @time: 2022/4/27 9:31 |
109 | 109 | */ |
110 | - public function addFile($file_name,$content){ |
|
111 | - $this->client->addFromString($file_name,$content); |
|
110 | + public function addFile($file_name, $content) { |
|
111 | + $this->client->addFromString($file_name, $content); |
|
112 | 112 | return $this; |
113 | 113 | } |
114 | 114 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * 文件下载 |
117 | 117 | * @return void |
118 | 118 | */ |
119 | - public function download(){ |
|
119 | + public function download() { |
|
120 | 120 | $this->client->finish(); |
121 | 121 | } |
122 | 122 | |
@@ -128,17 +128,17 @@ discard block |
||
128 | 128 | * @author: Tinymeng <[email protected]> |
129 | 129 | * @time: 2022/4/27 9:38 |
130 | 130 | */ |
131 | - public function unzip($filename,$dir){ |
|
132 | - if(!file_exists($filename)) |
|
131 | + public function unzip($filename, $dir) { |
|
132 | + if (!file_exists($filename)) |
|
133 | 133 | return 'File does not exist'; |
134 | - if(!$this->client->open($filename)) |
|
134 | + if (!$this->client->open($filename)) |
|
135 | 135 | return 'File open failed'; |
136 | - if(!is_dir($dir)){ |
|
137 | - mkdir($dir,775); |
|
138 | - }else{ |
|
136 | + if (!is_dir($dir)) { |
|
137 | + mkdir($dir, 775); |
|
138 | + } else { |
|
139 | 139 | return 'Dir mk failed'; |
140 | 140 | } |
141 | - if(!$this->client->extractTo($dir)) |
|
141 | + if (!$this->client->extractTo($dir)) |
|
142 | 142 | return 'File unzip failed'; |
143 | 143 | return $this; |
144 | 144 | } |
@@ -36,8 +36,9 @@ discard block |
||
36 | 36 | public function open($filename,$Fromfilename=null){ |
37 | 37 | if (!empty($filename)){ |
38 | 38 | $this->setFileName($filename); |
39 | - if(!$this->client->open($this->fileName, ZipArchive::CREATE)) |
|
40 | - return 'File open failed'; |
|
39 | + if(!$this->client->open($this->fileName, ZipArchive::CREATE)) { |
|
40 | + return 'File open failed'; |
|
41 | + } |
|
41 | 42 | } |
42 | 43 | if(!empty($Fromfilename)){ |
43 | 44 | if(is_dir($Fromfilename)){ |
@@ -54,7 +55,7 @@ discard block |
||
54 | 55 | } |
55 | 56 | } |
56 | 57 | } |
57 | - }else{ |
|
58 | + } else{ |
|
58 | 59 | $this->client->addFile ($Fromfilename); |
59 | 60 | } |
60 | 61 | } |
@@ -129,17 +130,20 @@ discard block |
||
129 | 130 | * @time: 2022/4/27 9:38 |
130 | 131 | */ |
131 | 132 | public function unzip($filename,$dir){ |
132 | - if(!file_exists($filename)) |
|
133 | - return 'File does not exist'; |
|
134 | - if(!$this->client->open($filename)) |
|
135 | - return 'File open failed'; |
|
133 | + if(!file_exists($filename)) { |
|
134 | + return 'File does not exist'; |
|
135 | + } |
|
136 | + if(!$this->client->open($filename)) { |
|
137 | + return 'File open failed'; |
|
138 | + } |
|
136 | 139 | if(!is_dir($dir)){ |
137 | 140 | mkdir($dir,775); |
138 | - }else{ |
|
141 | + } else{ |
|
139 | 142 | return 'Dir mk failed'; |
140 | 143 | } |
141 | - if(!$this->client->extractTo($dir)) |
|
142 | - return 'File unzip failed'; |
|
144 | + if(!$this->client->extractTo($dir)) { |
|
145 | + return 'File unzip failed'; |
|
146 | + } |
|
143 | 147 | return $this; |
144 | 148 | } |
145 | 149 |
@@ -13,11 +13,11 @@ discard block |
||
13 | 13 | */ |
14 | 14 | private static $instance = null; |
15 | 15 | |
16 | - public function __construct($config=null){ |
|
16 | + public function __construct($config = null) { |
|
17 | 17 | $this->config = $config; |
18 | 18 | } |
19 | 19 | |
20 | - private function __clone(){} |
|
20 | + private function __clone() {} |
|
21 | 21 | |
22 | 22 | public function __sleep(): array |
23 | 23 | { |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | return []; |
26 | 26 | } |
27 | 27 | |
28 | - protected static function init($gateway, $config=null) |
|
28 | + protected static function init($gateway, $config = null) |
|
29 | 29 | { |
30 | 30 | if (!self::$instance instanceof static) { |
31 | 31 | self::$instance = new static($config); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param $config |
42 | 42 | * @return mixed |
43 | 43 | */ |
44 | - public static function __callStatic($gateway, $config=null) |
|
44 | + public static function __callStatic($gateway, $config = null) |
|
45 | 45 | { |
46 | 46 | return self::init($gateway, ...$config); |
47 | 47 | } |