Passed
Push — 2.x ( c47f49...8be9c2 )
by Terry
01:48
created
src/Firewall/Panel/Ajax.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
      *
49 49
      * @return bool
50 50
      */
51
-    public function  __call($function , $args)
51
+    public function  __call($function, $args)
52 52
     {
53 53
         $className = 'Shieldon\Firewall\Panel\Sandbox\\' . $function;
54 54
 
Please login to merge, or discard this patch.
src/Firewall/Panel/Home.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -236,11 +236,11 @@
 block discarded – undo
236 236
     private function overviewTemplateVarsOfComponents(array $data = []): array
237 237
     {
238 238
         $data['components'] = [
239
-            'Ip'         => (!empty($this->kernel->component['Ip']))         ? true : false,
239
+            'Ip'         => (!empty($this->kernel->component['Ip'])) ? true : false,
240 240
             'TrustedBot' => (!empty($this->kernel->component['TrustedBot'])) ? true : false,
241
-            'Header'     => (!empty($this->kernel->component['Header']))     ? true : false,
242
-            'Rdns'       => (!empty($this->kernel->component['Rdns']))       ? true : false,
243
-            'UserAgent'  => (!empty($this->kernel->component['UserAgent']))  ? true : false,
241
+            'Header'     => (!empty($this->kernel->component['Header'])) ? true : false,
242
+            'Rdns'       => (!empty($this->kernel->component['Rdns'])) ? true : false,
243
+            'UserAgent'  => (!empty($this->kernel->component['UserAgent'])) ? true : false,
244 244
         ];
245 245
 
246 246
         return $data;
Please login to merge, or discard this patch.
src/Firewall/Panel/Report.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
                 $data['period_data'] = $ipDetailsCachedData['period_data'];
128 128
                 $lastCachedTime = date('Y-m-d H:i:s', $ipDetailsCachedData['time']);
129 129
     
130
-                if ('today' === $type ) {
130
+                if ('today' === $type) {
131 131
                     $ipDetailsCachedData = $logCacheHandler->get('past_seven_hours');
132 132
                     $data['past_seven_hours'] = $ipDetailsCachedData['period_data'];
133 133
                 }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
                 $logCacheHandler->save($type, $data);
143 143
     
144
-                if ('today' === $type ) {
144
+                if ('today' === $type) {
145 145
                     $this->parser->prepare('past_seven_hours');
146 146
                     $data['past_seven_hours'] = $this->parser->getParsedPeriodData();
147 147
 
@@ -172,11 +172,11 @@  discard block
 block discarded – undo
172 172
     private function operationTemplateVarsOfComponents(array $data = []): array
173 173
     {
174 174
         $data['components'] = [
175
-            'Ip'         => (!empty($this->kernel->component['Ip']))         ? true : false,
175
+            'Ip'         => (!empty($this->kernel->component['Ip'])) ? true : false,
176 176
             'TrustedBot' => (!empty($this->kernel->component['TrustedBot'])) ? true : false,
177
-            'Header'     => (!empty($this->kernel->component['Header']))     ? true : false,
178
-            'Rdns'       => (!empty($this->kernel->component['Rdns']))       ? true : false,
179
-            'UserAgent'  => (!empty($this->kernel->component['UserAgent']))  ? true : false,
177
+            'Header'     => (!empty($this->kernel->component['Header'])) ? true : false,
178
+            'Rdns'       => (!empty($this->kernel->component['Rdns'])) ? true : false,
179
+            'UserAgent'  => (!empty($this->kernel->component['UserAgent'])) ? true : false,
180 180
         ];
181 181
 
182 182
         return $data;
Please login to merge, or discard this patch.
templates/panel/template.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
 if (
98 98
     isset($_SERVER['HTTP_HOST']) && 
99 99
     strpos($_SERVER['HTTP_HOST'], 'project.lo') !== false
100
-)  {
100
+) {
101 101
     // `shieldon-doc.lo` is the virtual domain that Terry is using to design CSS for Firewall Panel UI.
102 102
     $staticSrc = 'http://shieldon-doc.lo/static';
103 103
 }
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
                 </div>
331 331
             </div>
332 332
         </div>
333
-        <?php if (! empty($this->messages)) : ?>
333
+        <?php if (!empty($this->messages)) : ?>
334 334
         <div id="message-modal" class="modal fade" tabindex="-1" role="dialog">
335 335
             <div class="modal-dialog modal-dialog-centered modal-lightbox" role="document">
336 336
                 <div class="modal-content">
Please login to merge, or discard this patch.
src/Firewall/Driver/FileDriver.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/Driver/SqlDriverProvider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 
303 303
         // @codeCoverageIgnoreStart
304 304
         
305
-        } catch(Exception $e) {
305
+        } catch (Exception $e) {
306 306
             return false;
307 307
         }
308 308
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 
362 362
         // @codeCoverageIgnoreStart
363 363
 
364
-        } catch(Exception $e) {
364
+        } catch (Exception $e) {
365 365
             return false;
366 366
         }
367 367
 
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 
415 415
         // @codeCoverageIgnoreStart
416 416
 
417
-        } catch(Exception $e) {
417
+        } catch (Exception $e) {
418 418
             return false;
419 419
         }
420 420
 
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
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
             default:
209 209
 
210 210
                 // We also accept querying N days data from logs. For example: `past_365_days`.
211
-                if (preg_match('/past_([0-9]+)_days/', $this->type, $matches) ) {
211
+                if (preg_match('/past_([0-9]+)_days/', $this->type, $matches)) {
212 212
 
213 213
                     $dayCount = $matches[1];
214 214
                     $startDate = date('Ymd', strtotime('-' . $dayCount . ' days'));
@@ -331,21 +331,21 @@  discard block
 block discarded – undo
331 331
             return [];
332 332
         }
333 333
 
334
-        $results['captcha_chart_string']  = '';     // string
335
-        $results['pageview_chart_string'] = '';     // string
336
-        $results['captcha_success_count'] = 0;      // integer
337
-        $results['captcha_failure_count'] = 0;      // integer
338
-        $results['captcha_count'] = 0;              // integer
339
-        $results['pageview_count'] = 0;             // integer
340
-        $results['captcha_percentageage'] = 0;      // integer
334
+        $results['captcha_chart_string']  = ''; // string
335
+        $results['pageview_chart_string'] = ''; // string
336
+        $results['captcha_success_count'] = 0; // integer
337
+        $results['captcha_failure_count'] = 0; // integer
338
+        $results['captcha_count'] = 0; // integer
339
+        $results['pageview_count'] = 0; // integer
340
+        $results['captcha_percentageage'] = 0; // integer
341 341
         $results['captcha_failure_percentage'] = 0; // integer
342 342
         $results['captcha_success_percentage'] = 0; // integer
343 343
 
344
-        $results['action_ban_count'] = 0;           // integer
345
-        $results['action_temp_ban_count'] = 0;      // integer
346
-        $results['action_unban_count'] = 0;         // integer
347
-        $results['blacklist_count'] = 0;            // integer
348
-        $results['session_limit_count'] = 0;        // integer
344
+        $results['action_ban_count'] = 0; // integer
345
+        $results['action_temp_ban_count'] = 0; // integer
346
+        $results['action_unban_count'] = 0; // integer
347
+        $results['blacklist_count'] = 0; // integer
348
+        $results['session_limit_count'] = 0; // integer
349 349
 
350 350
         $ipdData = $this->getIpData();
351 351
 
@@ -386,22 +386,22 @@  discard block
 block discarded – undo
386 386
     {
387 387
         $periodData = $this->getPeriodData();
388 388
 
389
-        $results['captcha_chart_string']  = '';     // string
390
-        $results['pageview_chart_string'] = '';     // string
391
-        $results['label_chart_string'] = '';        // string
392
-        $results['captcha_success_count'] = 0;      // integer
393
-        $results['captcha_failure_count'] = 0;      // integer
394
-        $results['captcha_count'] = 0;              // integer
395
-        $results['pageview_count'] = 0;             // integer
396
-        $results['captcha_percentageage'] = 0;      // integer
389
+        $results['captcha_chart_string']  = ''; // string
390
+        $results['pageview_chart_string'] = ''; // string
391
+        $results['label_chart_string'] = ''; // string
392
+        $results['captcha_success_count'] = 0; // integer
393
+        $results['captcha_failure_count'] = 0; // integer
394
+        $results['captcha_count'] = 0; // integer
395
+        $results['pageview_count'] = 0; // integer
396
+        $results['captcha_percentageage'] = 0; // integer
397 397
         $results['captcha_failure_percentage'] = 0; // integer
398 398
         $results['captcha_success_percentage'] = 0; // integer
399 399
 
400
-        $results['action_ban_count'] = 0;           // integer
401
-        $results['action_temp_ban_count'] = 0;      // integer
402
-        $results['action_unban_count'] = 0;         // integer
403
-        $results['blacklist_count'] = 0;            // integer
404
-        $results['session_limit_count'] = 0;        // integer
400
+        $results['action_ban_count'] = 0; // integer
401
+        $results['action_temp_ban_count'] = 0; // integer
402
+        $results['action_unban_count'] = 0; // integer
403
+        $results['blacklist_count'] = 0; // integer
404
+        $results['session_limit_count'] = 0; // integer
405 405
 
406 406
         if (!empty($periodData)) {
407 407
 
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
             }
432 432
 
433 433
             $results['captcha_chart_string'] = implode(',', $chartCaptcha);
434
-            $results['pageview_chart_string']= implode(',', $chartPageview);
434
+            $results['pageview_chart_string'] = implode(',', $chartPageview);
435 435
             $results['captcha_success_chart_string'] = implode(',', $chartCaptchaSuccess);
436 436
             $results['captcha_failure_chart_string'] = implode(',', $chartCaptchaFailure);
437 437
             $results['label_chart_string'] = "'" . implode("','", $labels) . "'";
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
         $ip = $log['ip'];
462 462
         $sessionId = $log['session_id'];
463 463
 
464
-        $this->ipDetail[$t][$ip]['session_id'][$sessionId ] = 1;
464
+        $this->ipDetail[$t][$ip]['session_id'][$sessionId] = 1;
465 465
 
466 466
         if ($logActionCode === self::LOG_TEMPORARILY_BAN) {
467 467
             $this->periodDetail[$t][$k]['action_temp_ban_count']++;
Please login to merge, or discard this patch.
src/Firewall/Log/ActionLogger.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -100,10 +100,10 @@
 block discarded – undo
100 100
             $record['session_id'] = substr($record['session_id'], 0, 4);
101 101
         }
102 102
 
103
-        $data[0] = $record['ip']          ?? 'null';
104
-        $data[1] = $record['session_id']  ?? 'null';
103
+        $data[0] = $record['ip'] ?? 'null';
104
+        $data[1] = $record['session_id'] ?? 'null';
105 105
         $data[2] = $record['action_code'] ?? 'null';
106
-        $data[3] = $record['timesamp']    ?? 'null';
106
+        $data[3] = $record['timesamp'] ?? 'null';
107 107
 
108 108
         file_put_contents($this->filePath, implode(',', $data) . "\n", FILE_APPEND | LOCK_EX);
109 109
     }
Please login to merge, or discard this patch.
templates/panel/table_sessions.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
             </div>
40 40
             <div class="board-field right">
41 41
                 <div class="heading"><?php _e('panel', 'table_heading_period', 'Period'); ?></div>
42
-                <div class="nums"><?php echo number_format($session_limit_period ); ?></div>
42
+                <div class="nums"><?php echo number_format($session_limit_period); ?></div>
43 43
                 <div class="note"><?php _e('panel', 'table_note_period', 'Keep-alive period. (minutes)'); ?></div>
44 44
             </div>
45 45
         </div>
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
             </div>
50 50
             <div class="board-field right">
51 51
                 <div class="heading"><?php _e('panel', 'table_heading_online', 'Online'); ?></div>
52
-                <div class="nums"><?php echo number_format($online_count ); ?></div>
52
+                <div class="nums"><?php echo number_format($online_count); ?></div>
53 53
                 <div class="note"><?php _e('panel', 'table_note_online', 'Online session amount.'); ?></div>
54 54
             </div>
55 55
         </div>
@@ -89,14 +89,14 @@  discard block
 block discarded – undo
89 89
 
90 90
                         $remainsTime = $expires - (time() - $sessionInfo['time']);
91 91
 
92
-                        if ($remainsTime < 1 ) {
92
+                        if ($remainsTime < 1) {
93 93
                             $remainsTime = 0;
94 94
                         }
95 95
 
96
-                        if ($i < $session_limit_count ) {
96
+                        if ($i < $session_limit_count) {
97 97
                             $satusName = __('panel', 'table_text_allowable', 'Allowable');
98 98
 
99
-                            if ($remainsTime < 1 ) {
99
+                            if ($remainsTime < 1) {
100 100
                                 $satusName = __('panel', 'table_text_expired', 'Expired');
101 101
                             }
102 102
                         } else {
Please login to merge, or discard this patch.