Passed
Push — master ( bd53be...f88a39 )
by ma
02:45
created
src/Encryption.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 
38 38
         if($operation == 'decode'){
39 39
             $string = base64_decode(substr($string, $ckey_length));
40
-        }else{
40
+        } else{
41 41
             $a = $expiry ? $expiry + time() : 0;
42 42
             $string = sprintf('%010d', $a).substr(md5($string.$keyb), 0, 16).$string;
43 43
         }
Please login to merge, or discard this patch.
src/ArrayTool.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
         }
24 24
         if($type == 'asc'){
25 25
             asort($keysValue);
26
-        }else{
26
+        } else{
27 27
             arsort($keysValue);
28 28
         }
29 29
         reset($keysValue);
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
             if(is_array($val)){
89 89
                 if(empty($val)){
90 90
                     settype($val,'object');
91
-                }else{
91
+                } else{
92 92
                     self::nullArrayToObject($val);
93 93
                 }
94 94
             }
Please login to merge, or discard this patch.
src/FileTool.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         //内容写入文件
63 63
         if($file_append === false){
64 64
             file_put_contents($file_name,$content);
65
-        }else{
65
+        } else{
66 66
             file_put_contents($file_name,$content,FILE_APPEND);
67 67
         }
68 68
     }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             $handle = fopen($file_name, 'w');
93 93
             fwrite($handle, $content);
94 94
             fclose($handle);
95
-        }else{
95
+        } else{
96 96
             $handle = fopen($file_name, 'a');
97 97
             fwrite($handle, $content);
98 98
             fclose($handle);
Please login to merge, or discard this patch.
src/StringTool.php 1 patch
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Tool.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@
 block discarded – undo
19 19
     public static function getIp(){
20 20
         if(!empty($_SERVER["HTTP_CLIENT_IP"])){
21 21
             $cip = $_SERVER["HTTP_CLIENT_IP"];
22
-        }else if(!empty($_SERVER["HTTP_X_FORWARDED_FOR"])){
22
+        } else if(!empty($_SERVER["HTTP_X_FORWARDED_FOR"])){
23 23
             $cip = $_SERVER["HTTP_X_FORWARDED_FOR"];
24
-        }else if(!empty($_SERVER["REMOTE_ADDR"])){
24
+        } else if(!empty($_SERVER["REMOTE_ADDR"])){
25 25
             $cip = $_SERVER["REMOTE_ADDR"];
26
-        }else{
26
+        } else{
27 27
             $cip = '';
28 28
         }
29 29
         preg_match("/[\d\.]{7,15}/", $cip, $cips);
Please login to merge, or discard this patch.
src/ZipTool.php 1 patch
Braces   +14 added lines, -10 removed lines patch added patch discarded remove patch
@@ -36,8 +36,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/UniqueId.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -99,8 +99,7 @@
 block discarded – undo
99 99
         {
100 100
             //	use crc32 hash value instead of rand
101 101
             $nRand	= crc32( $sSource );
102
-        }
103
-        else
102
+        } else
104 103
         {
105 104
             //	0 ~ 4095
106 105
             $nRand	= rand( 0, 0xFFF );
Please login to merge, or discard this patch.
src/exception/TException.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@
 block discarded – undo
21 21
         $this->setHeaders($headers);
22 22
 
23 23
         /** message */
24
-        if(empty($message)) $message = StatusCode::$status_code[$statusCode] ?? StatusCode::$status_code[StatusCode::COMMON_UNKNOWN];
24
+        if(empty($message)) {
25
+            $message = StatusCode::$status_code[$statusCode] ?? StatusCode::$status_code[StatusCode::COMMON_UNKNOWN];
26
+        }
25 27
         parent::__construct('ERROR tinymeng tools: '.$message, $code, $previous);
26 28
     }
27 29
 
Please login to merge, or discard this patch.
src/HttpRequest.php 1 patch
Braces   +10 added lines, -6 removed lines patch added patch discarded remove patch
@@ -66,7 +66,9 @@  discard block
 block discarded – undo
66 66
         curl_setopt($curl, CURLOPT_POSTFIELDS, $param);
67 67
 
68 68
         /** 设置请求headers */
69
-        if(empty($httpHeaders)) $httpHeaders = self::$httpHeaders;
69
+        if(empty($httpHeaders)) {
70
+            $httpHeaders = self::$httpHeaders;
71
+        }
70 72
         curl_setopt($curl, CURLOPT_HTTPHEADER, $httpHeaders);
71 73
 
72 74
         /** gzip压缩 */
@@ -100,14 +102,14 @@  discard block
 block discarded – undo
100 102
                 throw new TException(StatusCode::COMMON_TINYMENG_REQUEST_METHOD,
101 103
                     '[httpPost]: POST request was aborted ! Request url :' . $url . ' , post request data : ' . var_export($param,true)
102 104
                 );
103
-            }elseif(intval($info["http_code"]) != $http_code){
105
+            } elseif(intval($info["http_code"]) != $http_code){
104 106
                 throw new TException(StatusCode::COMMON_TINYMENG_REQUEST_METHOD,
105 107
                     '[httpPost]: POST request was aborted ! Request url :' . $url . ' , post request data : ' . var_export($param,true).' ,return code : '.$info["http_code"] .' ,return content : '.$content
106 108
                 );
107 109
             } else {
108 110
                 return $content;
109 111
             }
110
-        }else{
112
+        } else{
111 113
             return $content;
112 114
         }
113 115
     }
@@ -154,7 +156,9 @@  discard block
 block discarded – undo
154 156
         }
155 157
 
156 158
         /** 设置请求headers */
157
-        if(empty($httpHeaders)) $httpHeaders = self::$httpHeaders;
159
+        if(empty($httpHeaders)) {
160
+            $httpHeaders = self::$httpHeaders;
161
+        }
158 162
         curl_setopt($curl, CURLOPT_HTTPHEADER, $httpHeaders);
159 163
 
160 164
         /** gzip压缩 */
@@ -173,14 +177,14 @@  discard block
 block discarded – undo
173 177
                 throw new TException(StatusCode::COMMON_TINYMENG_REQUEST_METHOD,
174 178
                     '[httpGet]: GET request was aborted ! Request url :' . $url
175 179
                 );
176
-            }elseif(intval($info["http_code"]) != $http_code){
180
+            } elseif(intval($info["http_code"]) != $http_code){
177 181
                 throw new TException(StatusCode::COMMON_TINYMENG_REQUEST_METHOD,
178 182
                     '[httpGet]: GET request was aborted ! Request url :' . $url .' ,return code : '.$info["http_code"] .' ,return content : '.$content
179 183
                 );
180 184
             } else {
181 185
                 return $content;
182 186
             }
183
-        }else{
187
+        } else{
184 188
             return $content;
185 189
         }
186 190
     }
Please login to merge, or discard this patch.