Passed
Branch 2.x (99e90b)
by Terry
01:55
created
src/Firewall/Firewall/MainTrait.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
         $frequencyQuota = [];
104 104
         foreach ($frequencyDefaults as $k => $quota) {
105
-            $i = 'quota_' .  $k;
105
+            $i = 'quota_' . $k;
106 106
             $frequencyQuota[$k] = $settings['frequency']['config'][$i] ?? $quota;
107 107
         }
108 108
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
         if (is_array($ipList)) {
236 236
             foreach ($ipList as $ip) {
237 237
 
238
-                if (0 === strpos($this->kernel->getCurrentUrl(), $ip['url']) ) {
238
+                if (0 === strpos($this->kernel->getCurrentUrl(), $ip['url'])) {
239 239
     
240 240
                     if ('allow' === $ip['rule']) {
241 241
                         $allowedList[] = $ip['ip'];
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
     {
305 305
         $setting = $this->getOption('failed_attempts_in_a_row', 'events');
306 306
 
307
-        $enableDataCircle     = $setting['data_circle']['enable']     ?: false;
307
+        $enableDataCircle     = $setting['data_circle']['enable'] ?: false;
308 308
         $enableSystemFirewall = $setting['system_firewall']['enable'] ?: false;
309 309
 
310 310
         $this->kernel->setProperty('deny_attempt_enable', [
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
         $recordAttempt = $this->getOption('record_attempt');
322 322
 
323 323
         $detectionPeriod = $recordAttempt['detection_period'] ?? 5;
324
-        $timeToReset     = $recordAttempt['time_to_reset']    ?? 1800;
324
+        $timeToReset     = $recordAttempt['time_to_reset'] ?? 1800;
325 325
 
326 326
         $this->kernel->setProperty('record_attempt_detection_period', $detectionPeriod);
327 327
         $this->kernel->setProperty('reset_attempt_counter', $timeToReset);
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
     protected function setIptablesBridgeDirectory(): void
336 336
     {
337 337
         $iptablesSetting = $this->getOption('config', 'iptables');
338
-        $this->kernel->setProperty('iptables_watching_folder',  $iptablesSetting['watching_folder']);
338
+        $this->kernel->setProperty('iptables_watching_folder', $iptablesSetting['watching_folder']);
339 339
     }
340 340
 
341 341
     /**
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 
350 350
         if ($sessionLimitSetting['enable']) {
351 351
 
352
-            $onlineUsers = $sessionLimitSetting['config']['count']  ?? 100;
352
+            $onlineUsers = $sessionLimitSetting['config']['count'] ?? 100;
353 353
             $alivePeriod = $sessionLimitSetting['config']['period'] ?? 300;
354 354
 
355 355
             $this->kernel->limitSession($onlineUsers, $alivePeriod);
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 
377 377
             $lastResetTime = $cronjobSetting['config']['last_update'];
378 378
 
379
-            if (!empty($lastResetTime) ) {
379
+            if (!empty($lastResetTime)) {
380 380
                 $lastResetTime = strtotime($lastResetTime);
381 381
             } else {
382 382
                 // @codeCoverageIgnoreStart
Please login to merge, or discard this patch.
src/Firewall/Log/ActionLogParser.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
         ];
198 198
 
199 199
         if (empty($dataRange[$this->type])) {
200
-            if (preg_match('/past_([0-9]+)_days/', $this->type, $matches) ) {
200
+            if (preg_match('/past_([0-9]+)_days/', $this->type, $matches)) {
201 201
                 $dayCount = $matches[1];
202 202
                 $startDate = date('Ymd', strtotime('-' . $dayCount . ' days'));
203 203
                 $endDate = date('Ymd');
@@ -336,21 +336,21 @@  discard block
 block discarded – undo
336 336
             return [];
337 337
         }
338 338
 
339
-        $results['captcha_chart_string']  = '';     // string
340
-        $results['pageview_chart_string'] = '';     // string
341
-        $results['captcha_success_count'] = 0;      // integer
342
-        $results['captcha_failure_count'] = 0;      // integer
343
-        $results['captcha_count'] = 0;              // integer
344
-        $results['pageview_count'] = 0;             // integer
345
-        $results['captcha_percentageage'] = 0;      // integer
339
+        $results['captcha_chart_string']  = ''; // string
340
+        $results['pageview_chart_string'] = ''; // string
341
+        $results['captcha_success_count'] = 0; // integer
342
+        $results['captcha_failure_count'] = 0; // integer
343
+        $results['captcha_count'] = 0; // integer
344
+        $results['pageview_count'] = 0; // integer
345
+        $results['captcha_percentageage'] = 0; // integer
346 346
         $results['captcha_failure_percentage'] = 0; // integer
347 347
         $results['captcha_success_percentage'] = 0; // integer
348 348
 
349
-        $results['action_ban_count'] = 0;           // integer
350
-        $results['action_temp_ban_count'] = 0;      // integer
351
-        $results['action_unban_count'] = 0;         // integer
352
-        $results['blacklist_count'] = 0;            // integer
353
-        $results['session_limit_count'] = 0;        // integer
349
+        $results['action_ban_count'] = 0; // integer
350
+        $results['action_temp_ban_count'] = 0; // integer
351
+        $results['action_unban_count'] = 0; // integer
352
+        $results['blacklist_count'] = 0; // integer
353
+        $results['session_limit_count'] = 0; // integer
354 354
 
355 355
         $ipdData = $this->getIpData();
356 356
 
@@ -391,22 +391,22 @@  discard block
 block discarded – undo
391 391
     {
392 392
         $periodData = $this->getPeriodData();
393 393
 
394
-        $results['captcha_chart_string']  = '';     // string
395
-        $results['pageview_chart_string'] = '';     // string
396
-        $results['label_chart_string'] = '';        // string
397
-        $results['captcha_success_count'] = 0;      // integer
398
-        $results['captcha_failure_count'] = 0;      // integer
399
-        $results['captcha_count'] = 0;              // integer
400
-        $results['pageview_count'] = 0;             // integer
401
-        $results['captcha_percentageage'] = 0;      // integer
394
+        $results['captcha_chart_string']  = ''; // string
395
+        $results['pageview_chart_string'] = ''; // string
396
+        $results['label_chart_string'] = ''; // string
397
+        $results['captcha_success_count'] = 0; // integer
398
+        $results['captcha_failure_count'] = 0; // integer
399
+        $results['captcha_count'] = 0; // integer
400
+        $results['pageview_count'] = 0; // integer
401
+        $results['captcha_percentageage'] = 0; // integer
402 402
         $results['captcha_failure_percentage'] = 0; // integer
403 403
         $results['captcha_success_percentage'] = 0; // integer
404 404
 
405
-        $results['action_ban_count'] = 0;           // integer
406
-        $results['action_temp_ban_count'] = 0;      // integer
407
-        $results['action_unban_count'] = 0;         // integer
408
-        $results['blacklist_count'] = 0;            // integer
409
-        $results['session_limit_count'] = 0;        // integer
405
+        $results['action_ban_count'] = 0; // integer
406
+        $results['action_temp_ban_count'] = 0; // integer
407
+        $results['action_unban_count'] = 0; // integer
408
+        $results['blacklist_count'] = 0; // integer
409
+        $results['session_limit_count'] = 0; // integer
410 410
 
411 411
         if (!empty($periodData)) {
412 412
 
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
             }
437 437
 
438 438
             $results['captcha_chart_string'] = implode(',', $chartCaptcha);
439
-            $results['pageview_chart_string']= implode(',', $chartPageview);
439
+            $results['pageview_chart_string'] = implode(',', $chartPageview);
440 440
             $results['captcha_success_chart_string'] = implode(',', $chartCaptchaSuccess);
441 441
             $results['captcha_failure_chart_string'] = implode(',', $chartCaptchaFailure);
442 442
             $results['label_chart_string'] = "'" . implode("','", $labels) . "'";
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
         $ip = $log['ip'];
467 467
         $sessionId = $log['session_id'];
468 468
 
469
-        $this->ipDetail[$t][$ip]['session_id'][$sessionId ] = 1;
469
+        $this->ipDetail[$t][$ip]['session_id'][$sessionId] = 1;
470 470
 
471 471
         if ($logActionCode === self::LOG_TEMPORARILY_BAN) {
472 472
             $this->periodDetail[$t][$k]['action_temp_ban_count']++;
Please login to merge, or discard this patch.