Passed
Push — 2.x ( 3b4be6...b1b8b2 )
by Terry
01:55
created
src/Firewall/Driver/RedisDriver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
                 $keys = $this->redis->keys($this->getNamespace($type) . ':*');
99 99
 
100
-                foreach($keys as $key) {
100
+                foreach ($keys as $key) {
101 101
                     $content = $this->redis->get($key);
102 102
                     $content = json_decode($content, true);
103 103
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
             $keys = $this->redis->keys($this->getNamespace($type) . ':*');
229 229
 
230 230
             if (!empty($keys)) {
231
-                foreach($keys as $key) {
231
+                foreach ($keys as $key) {
232 232
                     $this->redis->del($key);
233 233
                 }
234 234
             }
Please login to merge, or discard this patch.
src/Firewall/Driver/FileDriver.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
                     $it = new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS);
113 113
                     $files = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
114 114
     
115
-                    foreach($files as $file) {
115
+                    foreach ($files as $file) {
116 116
                         if ($file->isFile()) {
117 117
     
118 118
                             $content = json_decode(file_get_contents($file->getPath() . '/' . $file->getFilename()), true);
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
                 $it = new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS);
251 251
                 $files = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
252 252
     
253
-                foreach($files as $file) {
253
+                foreach ($files as $file) {
254 254
                     if ($file->isDir()) {
255 255
                         // @codeCoverageIgnoreStart
256 256
                         rmdir($file->getRealPath());
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
         // Check if are Shieldon directories removed or not.
277 277
         $result = (
278 278
             !is_dir($this->getDirectory('filter_log')) && 
279
-            !is_dir($this->getDirectory('rule'))       && 
279
+            !is_dir($this->getDirectory('rule')) && 
280 280
             !is_dir($this->getDirectory('session'))
281 281
         );
282 282
 
@@ -369,9 +369,9 @@  discard block
 block discarded – undo
369 369
             case 'filter_log':
370 370
                 return $this->directory . '/' . $this->tableFilterLogs . '/' . $ip . '.' . $this->extension;
371 371
             case 'session':
372
-                return $this->directory . '/' . $this->tableSessions   . '/' . $ip . '.' . $this->extension;
372
+                return $this->directory . '/' . $this->tableSessions . '/' . $ip . '.' . $this->extension;
373 373
             case 'rule':
374
-                return $this->directory . '/' . $this->tableRuleList   . '/' . $ip . '.' . $this->extension;
374
+                return $this->directory . '/' . $this->tableRuleList . '/' . $ip . '.' . $this->extension;
375 375
         }
376 376
 
377 377
         return '';
Please login to merge, or discard this patch.
src/Firewall/Component/Rdns.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
     public function isDenied(): bool
46 46
     {
47 47
         if (!empty($this->deniedList)) {
48
-            if (preg_match('/(' . implode('|', $this->deniedList). ')/i', $this->rdns)) {
48
+            if (preg_match('/(' . implode('|', $this->deniedList) . ')/i', $this->rdns)) {
49 49
                 return true;
50 50
             }
51 51
         }
Please login to merge, or discard this patch.
src/Firewall/Component/UserAgent.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -49,19 +49,19 @@  discard block
 block discarded – undo
49 49
         $this->deniedList = [
50 50
 
51 51
             // Backlink crawlers
52
-            'Ahrefs',     // http://ahrefs.com/robot/
53
-            'roger',      // rogerbot (SEOMOZ)
54
-            'moz.com',    // SEOMOZ crawlers
55
-            'MJ12bot',    // Majestic crawlers
56
-            'findlinks',  // http://wortschatz.uni-leipzig.de/findlinks
57
-            'Semrush',    // http://www.semrush.com/bot.html
52
+            'Ahrefs', // http://ahrefs.com/robot/
53
+            'roger', // rogerbot (SEOMOZ)
54
+            'moz.com', // SEOMOZ crawlers
55
+            'MJ12bot', // Majestic crawlers
56
+            'findlinks', // http://wortschatz.uni-leipzig.de/findlinks
57
+            'Semrush', // http://www.semrush.com/bot.html
58 58
     
59 59
             // Web information crawlers
60
-            'domain',     // Domain name information crawlers.
61
-            'copyright',  // Copyright information crawlers.
60
+            'domain', // Domain name information crawlers.
61
+            'copyright', // Copyright information crawlers.
62 62
     
63 63
             // Others
64
-            'archive',    // Wayback machine
64
+            'archive', // Wayback machine
65 65
         ];
66 66
     }
67 67
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     public function isDenied(): bool
72 72
     {
73 73
         if (!empty($this->deniedList)) {
74
-            if (preg_match('/(' . implode('|', $this->deniedList). ')/i', $this->userAgent)) {
74
+            if (preg_match('/(' . implode('|', $this->deniedList) . ')/i', $this->userAgent)) {
75 75
                 return true;
76 76
             }
77 77
         }
Please login to merge, or discard this patch.
src/Firewall/Component/Ip.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
         $ip = $ipData[0];
258 258
         $cidr = (int) $ipData[1] ?? 32;
259 259
 
260
-		$result[0] = long2ip((ip2long($ip)) & ((-1 << (32 - $cidr))));
260
+        $result[0] = long2ip((ip2long($ip)) & ((-1 << (32 - $cidr))));
261 261
         $result[1] = long2ip((ip2long($ip)) + pow(2, (32 - $cidr)) - 1);
262 262
 
263 263
         if ($isDecimal) {
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
             $result[1] = ip2long($result[1]);
266 266
         }
267 267
 
268
-		return $result;
268
+        return $result;
269 269
     }
270 270
 
271 271
     /**
Please login to merge, or discard this patch.
src/Firewall/Middleware/UserAgent.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -40,19 +40,19 @@  discard block
 block discarded – undo
40 40
     protected $deniedList = [
41 41
 
42 42
         // Backlink crawlers
43
-        'Ahrefs',     // http://ahrefs.com/robot/
44
-        'roger',      // rogerbot (SEOMOZ)
45
-        'moz.com',    // SEOMOZ crawlers
46
-        'MJ12bot',    // Majestic crawlers
47
-        'findlinks',  // http://wortschatz.uni-leipzig.de/findlinks
48
-        'Semrush',    // http://www.semrush.com/bot.html
43
+        'Ahrefs', // http://ahrefs.com/robot/
44
+        'roger', // rogerbot (SEOMOZ)
45
+        'moz.com', // SEOMOZ crawlers
46
+        'MJ12bot', // Majestic crawlers
47
+        'findlinks', // http://wortschatz.uni-leipzig.de/findlinks
48
+        'Semrush', // http://www.semrush.com/bot.html
49 49
 
50 50
         // Web information crawlers
51
-        'domain',     // Domain name information crawlers.
52
-        'copyright',  // Copyright information crawlers.
51
+        'domain', // Domain name information crawlers.
52
+        'copyright', // Copyright information crawlers.
53 53
 
54 54
         // Others
55
-        'archive',    // Wayback machine
55
+        'archive', // Wayback machine
56 56
     ];
57 57
 
58 58
     /**
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     public function __construct(array $deniedList = [])
66 66
     {
67 67
         if (!empty($deniedList)) {
68
-            $this->deniedList =$deniedList;
68
+            $this->deniedList = $deniedList;
69 69
         }
70 70
     }
71 71
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         }
87 87
 
88 88
         if (!empty($this->deniedList)) {
89
-            if (preg_match('/(' . implode('|', $this->deniedList). ')/i', $userAgent)) {
89
+            if (preg_match('/(' . implode('|', $this->deniedList) . ')/i', $userAgent)) {
90 90
                 return (new Response)->withStatus(self::HTTP_STATUS_CODE);
91 91
             }
92 92
         }
Please login to merge, or discard this patch.
src/Firewall/Middleware/Header.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
     public function __construct(array $fieldList = [])
52 52
     {
53 53
         if (!empty($fieldList)) {
54
-            $this->fieldList =$fieldList;
54
+            $this->fieldList = $fieldList;
55 55
         }
56 56
     }
57 57
 
Please login to merge, or discard this patch.
src/Firewall/Firewall.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
                     $this->kernel->add(new Driver\RedisDriver($redis));
270 270
 
271 271
                 // @codeCoverageIgnoreStart
272
-                } catch(RedisException $e) {
272
+                } catch (RedisException $e) {
273 273
                     $this->status = false;
274 274
 
275 275
                     echo $e->getMessage();
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
                     $this->kernel->add(new Driver\SqliteDriver($pdoInstance));
313 313
     
314 314
                 // @codeCoverageIgnoreStart
315
-                } catch(PDOException $e) {
315
+                } catch (PDOException $e) {
316 316
                     $this->status = false;
317 317
 
318 318
                     echo $e->getMessage();
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
                     // Create a PDO instance.
332 332
                     $pdoInstance = new PDO(
333 333
                         'mysql:host=' 
334
-                            . $mysqlSetting['host']   . ';dbname=' 
334
+                            . $mysqlSetting['host'] . ';dbname=' 
335 335
                             . $mysqlSetting['dbname'] . ';charset=' 
336 336
                             . $mysqlSetting['charset']
337 337
                         , (string) $mysqlSetting['user']
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
                     $this->kernel->add(new Driver\MysqlDriver($pdoInstance));
343 343
 
344 344
                 // @codeCoverageIgnoreStart
345
-                } catch(PDOException $e) {
345
+                } catch (PDOException $e) {
346 346
                     echo $e->getMessage();
347 347
                 }
348 348
                 // @codeCoverageIgnoreEnd
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
     protected function setIptablesWatchingFolder(): void
805 805
     {
806 806
         $iptablesSetting = $this->getOption('config', 'iptables');
807
-        $this->kernel->setProperty('iptables_watching_folder',  $iptablesSetting['watching_folder']);
807
+        $this->kernel->setProperty('iptables_watching_folder', $iptablesSetting['watching_folder']);
808 808
     }
809 809
 
810 810
     /**
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 
842 842
             $lastResetTime = $cronjobSetting['config']['last_update'];
843 843
 
844
-            if (!empty($lastResetTime) ) {
844
+            if (!empty($lastResetTime)) {
845 845
                 $lastResetTime = strtotime($lastResetTime);
846 846
             } else {
847 847
                 // @codeCoverageIgnoreStart
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
         if (!empty($ipList)) {
985 985
             foreach ($ipList as $ip) {
986 986
 
987
-                if (0 === strpos($this->kernel->getCurrentUrl(), $ip['url']) ) {
987
+                if (0 === strpos($this->kernel->getCurrentUrl(), $ip['url'])) {
988 988
     
989 989
                     if ('allow' === $ip['rule']) {
990 990
                         $allowedList[] = $ip['ip'];
Please login to merge, or discard this patch.
src/Firewall/IpTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,8 +53,8 @@
 block discarded – undo
53 53
 
54 54
             // Check if your IP is from localhost, perhaps your are in development environment?
55 55
             if (
56
-                (substr($this->ip, 0 , 8) === '192.168.') ||
57
-                (substr($this->ip, 0 , 6) === '127.0.')
56
+                (substr($this->ip, 0, 8) === '192.168.') ||
57
+                (substr($this->ip, 0, 6) === '127.0.')
58 58
             ) {
59 59
                 $this->setRdns('localhost');
60 60
             } else {
Please login to merge, or discard this patch.