Passed
Branch v6 (9335b3)
by 光春
04:49
created
src/facade/Xmls.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 // | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library
18 18
 // +----------------------------------------------------------------------
19 19
 
20
-declare (strict_types=1);
20
+declare(strict_types=1);
21 21
 
22 22
 namespace DtApp\ThinkLibrary\facade;
23 23
 
Please login to merge, or discard this patch.
src/Controller.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -73,7 +73,9 @@  discard block
 block discarded – undo
73 73
      */
74 74
     public function error($info, $data = '{-null-}', $code = 0)
75 75
     {
76
-        if ($data === '{-null-}') $data = new stdClass();
76
+        if ($data === '{-null-}') {
77
+            $data = new stdClass();
78
+        }
77 79
         throw new HttpResponseException(json([
78 80
             'code' => $code, 'info' => $info, 'data' => $data,
79 81
         ]));
@@ -87,7 +89,9 @@  discard block
 block discarded – undo
87 89
      */
88 90
     public function success($info, $data = '{-null-}', $code = 1)
89 91
     {
90
-        if ($data === '{-null-}') $data = new stdClass();
92
+        if ($data === '{-null-}') {
93
+            $data = new stdClass();
94
+        }
91 95
         throw new HttpResponseException(json([
92 96
             'code' => $code, 'info' => $info, 'data' => $data,
93 97
         ]));
@@ -110,7 +114,9 @@  discard block
 block discarded – undo
110 114
      */
111 115
     public function fetch($tpl = '', $vars = [])
112 116
     {
113
-        foreach ($this as $name => $value) $vars[$name] = $value;
117
+        foreach ($this as $name => $value) {
118
+            $vars[$name] = $value;
119
+        }
114 120
         throw new HttpResponseException(view($tpl, $vars));
115 121
     }
116 122
 
Please login to merge, or discard this patch.
src/session/Mysql.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     public function read(string $sessionId): string
58 58
     {
59 59
         return (string)Db::table($this->table_name)
60
-            ->where('session_id', $this->config['session_prefix'] . $sessionId)
60
+            ->where('session_id', $this->config['session_prefix'].$sessionId)
61 61
             ->whereTime('session_expire', '>=', time())
62 62
             ->order('session_expire desc')
63 63
             ->value('session_data', '');
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     public function delete(string $sessionId): bool
73 73
     {
74 74
         $result = Db::table($this->table_name)
75
-            ->where('session_id', $this->config['session_prefix'] . $sessionId)
75
+            ->where('session_id', $this->config['session_prefix'].$sessionId)
76 76
             ->delete();
77 77
         return $result ? true : false;
78 78
     }
@@ -89,20 +89,20 @@  discard block
 block discarded – undo
89 89
     public function write(string $sessionId, string $data): bool
90 90
     {
91 91
         $get = Db::table($this->table_name)
92
-            ->where('session_id', $this->config['session_prefix'] . $sessionId)
92
+            ->where('session_id', $this->config['session_prefix'].$sessionId)
93 93
             ->whereTime('session_expire', '>=', time())
94 94
             ->field('id')
95 95
             ->find();
96 96
         if (empty($get)) {
97 97
             $params = [
98
-                'session_id' => $this->config['session_prefix'] . $sessionId,
98
+                'session_id' => $this->config['session_prefix'].$sessionId,
99 99
                 'session_expire' => Times::dateRear("Y-m-d H:i:s", $this->config['session_expire']),
100 100
                 'session_data' => $data
101 101
             ];
102 102
             $result = Db::table($this->table_name)
103 103
                 ->insert($params);
104 104
             return $result ? true : false;
105
-        } else {
105
+        }else {
106 106
             $params = [
107 107
                 'session_expire' => Times::dateRear("Y-m-d H:i:s", $this->config['session_expire']),
108 108
                 'session_data' => $data
Please login to merge, or discard this patch.
src/ApiController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         }
187 187
         if (isset($this->aes_decrypt_data[$name])) {
188 188
             return $this->aes_decrypt_data[$name];
189
-        } else {
189
+        }else {
190 190
             return $default;
191 191
         }
192 192
     }
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
         $rear = strtotime('+2minute');
219 219
         if ($timestamp <= $rear && $timestamp >= $before) {
220 220
             $this->aes_decrypt_data = $data;
221
-        } else {
221
+        }else {
222 222
             $this->error('已超时,请重新尝试!');
223 223
         }
224 224
     }
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
         if (!empty(is_array($data))) {
241 241
             $data = json_encode($data);
242 242
         }
243
-        return urlencode(base64_encode(openssl_encrypt($data, 'AES-128-CBC', $this->aes_md5, 1, $this->aes_md5_iv . $timestamp)));
243
+        return urlencode(base64_encode(openssl_encrypt($data, 'AES-128-CBC', $this->aes_md5, 1, $this->aes_md5_iv.$timestamp)));
244 244
     }
245 245
 
246 246
     /**
@@ -257,6 +257,6 @@  discard block
 block discarded – undo
257 257
         if (empty($this->aes_md5_iv)) {
258 258
             $this->setAesMd5Iv();
259 259
         }
260
-        return openssl_decrypt(base64_decode(urldecode($data)), "AES-128-CBC", $this->aes_md5, true, $this->aes_md5_iv . $timestamp);
260
+        return openssl_decrypt(base64_decode(urldecode($data)), "AES-128-CBC", $this->aes_md5, true, $this->aes_md5_iv.$timestamp);
261 261
     }
262 262
 }
Please login to merge, or discard this patch.
src/exception/ThinkException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@
 block discarded – undo
105 105
                         'domain' => request()->domain(),
106 106
                         'url' => request()->url(),
107 107
                         'node' => config('dtapp.exception.wechat.node', ''),
108
-                        'info' => "ServerIp:" . $ip . ";CdnIp:" . $_SERVER['REMOTE_ADDR'] . ";ClientIp:" . get_ip(),
108
+                        'info' => "ServerIp:".$ip.";CdnIp:".$_SERVER['REMOTE_ADDR'].";ClientIp:".get_ip(),
109 109
                         'ip' => $ipinfo['location_all'],
110 110
                         'error' => base64_encode($msg)
111 111
                     ])
Please login to merge, or discard this patch.
src/common.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         if (empty($ip)) {
41 41
             if (!isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
42 42
                 $ip = $_SERVER['REMOTE_ADDR'];
43
-            } else {
43
+            }else {
44 44
                 //为了兼容百度的CDN,所以转成数组
45 45
                 $arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
46 46
                 $ip = $arr[0];
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
             //为了兼容百度的CDN,所以转成数组
62 62
             $arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
63 63
             return $arr[0];
64
-        } else {
64
+        }else {
65 65
             return $_SERVER['REMOTE_ADDR'];
66 66
         }
67 67
     }
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
         if (empty($value)) {
100 100
             return $myc->name($name)
101 101
                 ->get();
102
-        } else {
102
+        }else {
103 103
             if (empty($myc->name($name)
104 104
                 ->get())) {
105 105
                 $myc->name($name)
106 106
                     ->expire($expire)
107 107
                     ->set($value);
108
-            } else {
108
+            }else {
109 109
                 $myc->name($name)
110 110
                     ->expire($expire)
111 111
                     ->update($value);
Please login to merge, or discard this patch.
src/service/Ip/IpIpService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
         if (empty($this->ipPath)) {
51 51
             throw new DtaException('请检查配置文件是否配置了IP数据库文件存放位置');
52 52
         }
53
-        $this->reader = new IpIpReader($this->ipPath . 'ipipfree.ipdb');
53
+        $this->reader = new IpIpReader($this->ipPath.'ipipfree.ipdb');
54 54
         parent::__construct($app);
55 55
     }
56 56
 
Please login to merge, or discard this patch.
src/service/Ip/OnlineService.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -221,10 +221,10 @@  discard block
 block discarded – undo
221 221
             throw new DtaException('请检查阿里-阿里云配置信息 appcode');
222 222
         }
223 223
         $headers = array();
224
-        array_push($headers, "Authorization:APPCODE " . $appcode);
224
+        array_push($headers, "Authorization:APPCODE ".$appcode);
225 225
         $querys = "ip={$this->ip}";
226 226
         $bodys = "";
227
-        $url = $host . $path . "?" . $querys;
227
+        $url = $host.$path."?".$querys;
228 228
 
229 229
         $curl = curl_init();
230 230
         curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
         curl_setopt($curl, CURLOPT_FAILONERROR, false);
234 234
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
235 235
         curl_setopt($curl, CURLOPT_HEADER, false);
236
-        if (1 == strpos("$" . $host, "https://")) {
236
+        if (1 == strpos("$".$host, "https://")) {
237 237
             curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
238 238
             curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
239 239
         }
Please login to merge, or discard this patch.
src/service/Ip/IpIpReader.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -72,13 +72,13 @@  discard block
 block discarded – undo
72 72
             throw new Exception('IP Database metadata error.');
73 73
         }
74 74
 
75
-        $fileSize = 4 + $metaLength + $this->meta['total_size'];
75
+        $fileSize = 4+$metaLength+$this->meta['total_size'];
76 76
         if ($fileSize != $this->fileSize) {
77 77
             throw  new Exception('IP Database size error.');
78 78
         }
79 79
 
80 80
         $this->nodeCount = $this->meta['node_count'];
81
-        $this->nodeOffset = 4 + $metaLength;
81
+        $this->nodeOffset = 4+$metaLength;
82 82
     }
83 83
 
84 84
     /**
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     private function findNode($ip)
145 145
     {
146 146
         $binary = inet_pton($ip);
147
-        $bitCount = strlen($binary) * 8; // 32 | 128
147
+        $bitCount = strlen($binary)*8; // 32 | 128
148 148
         $key = substr($binary, 0, 2);
149 149
         $node = 0;
150 150
         $index = 0;
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
                 for ($i = 0; $i < 96 && $node < $this->nodeCount; $i++) {
154 154
                     if ($i >= 80) {
155 155
                         $idx = 1;
156
-                    } else {
156
+                    }else {
157 157
                         $idx = 0;
158 158
                     }
159 159
                     $node = $this->readNode($node, $idx);
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
                     }
163 163
                 }
164 164
                 $this->v4offset = $node;
165
-            } else {
165
+            }else {
166 166
                 $node = $this->v4offset;
167 167
             }
168
-        } else {
168
+        }else {
169 169
             if (isset($this->v6offsetCache[$key])) {
170 170
                 $index = 16;
171 171
                 $node = $this->v6offsetCache[$key];
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
                 break;
178 178
             }
179 179
 
180
-            $node = $this->readNode($node, 1 & ((0xFF & ord($binary[$i >> 3])) >> 7 - ($i % 8)));
180
+            $node = $this->readNode($node, 1 & ((0xFF & ord($binary[$i >> 3])) >> 7-($i%8)));
181 181
 
182 182
             if ($i == 15) {
183 183
                 $this->v6offsetCache[$key] = $node;
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
      */
202 202
     private function readNode($node, $index)
203 203
     {
204
-        return unpack('N', $this->read($this->file, $node * 8 + $index * 4, 4))[1];
204
+        return unpack('N', $this->read($this->file, $node*8+$index*4, 4))[1];
205 205
     }
206 206
 
207 207
     /**
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
      */
212 212
     private function resolve($node)
213 213
     {
214
-        $resolved = $node - $this->nodeCount + $this->nodeCount * 8;
214
+        $resolved = $node-$this->nodeCount+$this->nodeCount*8;
215 215
         if ($resolved >= $this->fileSize) {
216 216
             return NULL;
217 217
         }
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
     private function read($stream, $offset, $length)
242 242
     {
243 243
         if ($length > 0) {
244
-            if (fseek($stream, $offset + $this->nodeOffset) === 0) {
244
+            if (fseek($stream, $offset+$this->nodeOffset) === 0) {
245 245
                 $value = fread($stream, $length);
246 246
                 if (strlen($value) === $length) {
247 247
                     return $value;
Please login to merge, or discard this patch.