Passed
Push — 2.x ( 4516a4...0d32ef )
by Terry
01:53
created
src/Firewall/Firewall/Messenger/ItemSmtp.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@
 block discarded – undo
30 30
      */
31 31
     public static function get(array $setting): MessengerInterface
32 32
     {
33
-        $sender     = $setting['config']['sender']     ?? '';
33
+        $sender     = $setting['config']['sender'] ?? '';
34 34
         $recipients = $setting['config']['recipients'] ?? [];
35
-        $host       = $setting['config']['host']       ?? '';
36
-        $user       = $setting['config']['user']       ?? '';
37
-        $pass       = $setting['config']['pass']       ?? '';
35
+        $host       = $setting['config']['host'] ?? '';
36
+        $user       = $setting['config']['user'] ?? '';
37
+        $pass       = $setting['config']['pass'] ?? '';
38 38
         $port       = $setting['config']['port'] ?? '';
39 39
 
40 40
         $instance = new Smtp($user, $pass, $host, (int) $port);
Please login to merge, or discard this patch.
src/Firewall/Firewall/Messenger/ItemPhpNativeMail.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
      */
31 31
     public static function get(array $setting): MessengerInterface
32 32
     {
33
-        $sender     = $setting['config']['sender']     ?? '';
33
+        $sender     = $setting['config']['sender'] ?? '';
34 34
         $recipients = $setting['config']['recipients'] ?? [];
35 35
 
36 36
         $instance = new Mail();
Please login to merge, or discard this patch.
src/Firewall/Firewall/Messenger/ItemRocketChat.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,10 +29,10 @@
 block discarded – undo
29 29
      */
30 30
     public static function get(array $setting): MessengerInterface
31 31
     {
32
-        $serverUrl   = $setting['config']['server_url']   ?? '';
33
-        $userId      = $setting['config']['user_id']      ?? '';
32
+        $serverUrl   = $setting['config']['server_url'] ?? '';
33
+        $userId      = $setting['config']['user_id'] ?? '';
34 34
         $accessToken = $setting['config']['access_token'] ?? '';
35
-        $channel     = $setting['config']['channel']      ?? '';
35
+        $channel     = $setting['config']['channel'] ?? '';
36 36
 
37 37
         return new RocketChat($accessToken, $userId, $serverUrl, $channel);
38 38
     }
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.
src/Firewall/Driver/FileDriverTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -356,8 +356,8 @@
 block discarded – undo
356 356
         $path = [];
357 357
 
358 358
         $path['filter'] = $this->directory . '/' . $this->tableFilterLogs . '/' . $ip . '.' . $this->extension;
359
-        $path['session'] = $this->directory . '/' . $this->tableSessions   . '/' . $ip . '.' . $this->extension;
360
-        $path['rule'] = $this->directory . '/' . $this->tableRuleList   . '/' . $ip . '.' . $this->extension;
359
+        $path['session'] = $this->directory . '/' . $this->tableSessions . '/' . $ip . '.' . $this->extension;
360
+        $path['rule'] = $this->directory . '/' . $this->tableRuleList . '/' . $ip . '.' . $this->extension;
361 361
 
362 362
         return $path[$type] ?? '';
363 363
     }
Please login to merge, or discard this patch.
src/Firewall/Kernel.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -614,9 +614,9 @@
 block discarded – undo
614 614
         $this->initComponents();
615 615
 
616 616
         $processMethods = [
617
-            'isRuleExist',   // Stage 1 - Looking for rule table.
618
-            'isTrustedBot',  // Stage 2 - Detect popular search engine.
619
-            'isFakeRobot',   // Stage 3 - Reject fake search engine crawlers.
617
+            'isRuleExist', // Stage 1 - Looking for rule table.
618
+            'isTrustedBot', // Stage 2 - Detect popular search engine.
619
+            'isFakeRobot', // Stage 3 - Reject fake search engine crawlers.
620 620
             'isIpComponent', // Stage 4 - IP manager.
621 621
             'isComponents'   // Stage 5 - Check other components.
622 622
         ];
Please login to merge, or discard this patch.
src/Firewall/Panel/Ajax.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      *
58 58
      * @return bool
59 59
      */
60
-    public function __call($function , $args)
60
+    public function __call($function, $args)
61 61
     {
62 62
         $className = 'Shieldon\Firewall\Panel\Sandbox\\' . $function;
63 63
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
         $method = implode(
119 119
             '', 
120 120
             array_map(
121
-                function ($word) {
121
+                function($word) {
122 122
                     return ucwords($word); 
123 123
                 }, 
124 124
                 $method
Please login to merge, or discard this patch.
src/Firewall/Panel/BaseController.php 1 patch
Spacing   +3 added lines, -5 removed lines patch added patch discarded remove patch
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
             define('SHIELDON_VIEW', true);
170 170
         }
171 171
 
172
-        $viewFilePath =  __DIR__ . '/../../../templates/' . $page . '.php';
172
+        $viewFilePath = __DIR__ . '/../../../templates/' . $page . '.php';
173 173
     
174 174
         if (!empty($data)) {
175 175
             extract($data);
@@ -451,12 +451,10 @@  discard block
 block discarded – undo
451 451
     protected function messengerAjaxStatus(string $moduleName, string $echoType = 'css'): void
452 452
     {
453 453
         $echo['css'] = $this->getConfig('messengers.' . $moduleName . '.confirm_test') ? 
454
-            'success' :
455
-            '';
454
+            'success' : '';
456 455
         
457 456
         $echo['icon'] = $this->getConfig('messengers.' . $moduleName . '.confirm_test') ?
458
-            '<i class="fas fa-check"></i>' :
459
-            '<i class="fas fa-exclamation"></i>';
457
+            '<i class="fas fa-check"></i>' : '<i class="fas fa-exclamation"></i>';
460 458
 
461 459
         echo $echo[$echoType];
462 460
     }
Please login to merge, or discard this patch.
src/Firewall/Panel/ConfigMethodsTrait.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
             // Create default log files.
178 178
             if (is_writable($iptablesWatchingFolder)) {
179 179
                 fopen($iptablesWatchingFolder . '/iptables_queue.log', 'w+');
180
-                fopen($iptablesWatchingFolder . '/ipv4_status.log',    'w+');
181
-                fopen($iptablesWatchingFolder . '/ipv6_status.log',    'w+');
182
-                fopen($iptablesWatchingFolder . '/ipv4_command.log',   'w+');
183
-                fopen($iptablesWatchingFolder . '/ipv6_command.log',   'w+');
180
+                fopen($iptablesWatchingFolder . '/ipv4_status.log', 'w+');
181
+                fopen($iptablesWatchingFolder . '/ipv6_status.log', 'w+');
182
+                fopen($iptablesWatchingFolder . '/ipv4_command.log', 'w+');
183
+                fopen($iptablesWatchingFolder . '/ipv6_command.log', 'w+');
184 184
 
185 185
                 return $result;
186 186
             }
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
                     (string) $db['user'],
254 254
                     (string) $db['pass']
255 255
                 );
256
-            } catch(PDOException $e) {
256
+            } catch (PDOException $e) {
257 257
 
258 258
                 $result = false;
259 259
 
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
             try {
315 315
                 new PDO('sqlite:' . $sqliteFilePath);
316 316
 
317
-            } catch(PDOException $e) { 
317
+            } catch (PDOException $e) { 
318 318
                 $this->pushMessage('error', $e->getMessage());
319 319
                 $result = false;
320 320
             }
@@ -363,11 +363,11 @@  discard block
 block discarded – undo
363 363
                 $redis = new Redis();
364 364
                 $redis->connect(
365 365
                     (string) $this->getConfig('drivers.redis.host'), 
366
-                    (int)    $this->getConfig('drivers.redis.port')
366
+                    (int) $this->getConfig('drivers.redis.port')
367 367
                 );
368 368
                 unset($redis);
369 369
 
370
-            } catch(RedisException $e) {
370
+            } catch (RedisException $e) {
371 371
                 $this->pushMessage('error', $e->getMessage());
372 372
                 $result = false;
373 373
             }
Please login to merge, or discard this patch.