Passed
Push — 2.x ( da3964...4ff14b )
by Terry
01:53
created
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/setting/daemon.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -304,9 +304,12 @@
 block discarded – undo
304 304
                 <div>
305 305
                     <?php if ($this->mode === 'demo') : ?>
306 306
                         <code id="code1" style="display: none">* * * * * root bash your_project_folder/vendor/shieldon/bin/iptables_bridge.sh --watch=your_watching_folder >> /var/log/shieldon.log 2>&1</code>
307
-                    <?php else: ?>
307
+                    <?php else {
308
+    : ?>
308 309
                         <code id="code1" style="display: none">* * * * * root bash <?php echo realpath(__DIR__ . '/../../../bin/iptables_bridge.sh') ?> --watch=<span id="iptables-watch-folder"></span> >> /var/log/shieldon.log 2>&1</code>
309
-                    <?php endif; ?>
310
+                    <?php endif;
311
+}
312
+?>
310 313
                     
311 314
                     <textarea id="code2" class="form-control" rows="4" style="font-size: 12px; font-family: monospace;"></textarea>
312 315
                 </div><br />
Please login to merge, or discard this patch.
src/Firewall/Panel/BaseController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
             define('SHIELDON_VIEW', true);
175 175
         }
176 176
 
177
-        $viewFilePath =  __DIR__ . '/../../../templates/' . $page . '.php';
177
+        $viewFilePath = __DIR__ . '/../../../templates/' . $page . '.php';
178 178
     
179 179
         if (!empty($data)) {
180 180
             extract($data);
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
                     } else {
526 526
                         if (is_numeric($postData)) {
527 527
                             $this->setConfig(str_replace('__', '.', $postKey), (int) $postData);
528
-                        } else  {
528
+                        } else {
529 529
                             $this->setConfig(str_replace('__', '.', $postKey), $postData);
530 530
                         }
531 531
                     }
@@ -613,10 +613,10 @@  discard block
 block discarded – undo
613 613
                 // Create default log files.
614 614
                 if (is_writable($iptablesWatchingFolder)) {
615 615
                     fopen($iptablesWatchingFolder . '/iptables_queue.log', 'w+');
616
-                    fopen($iptablesWatchingFolder . '/ipv4_status.log',    'w+');
617
-                    fopen($iptablesWatchingFolder . '/ipv6_status.log',    'w+');
618
-                    fopen($iptablesWatchingFolder . '/ipv4_command.log',   'w+');
619
-                    fopen($iptablesWatchingFolder . '/ipv6_command.log',   'w+');
616
+                    fopen($iptablesWatchingFolder . '/ipv4_status.log', 'w+');
617
+                    fopen($iptablesWatchingFolder . '/ipv6_status.log', 'w+');
618
+                    fopen($iptablesWatchingFolder . '/ipv4_command.log', 'w+');
619
+                    fopen($iptablesWatchingFolder . '/ipv6_command.log', 'w+');
620 620
                 }
621 621
             }
622 622
     
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
                     (string) $db['user'],
695 695
                     (string) $db['pass']
696 696
                 );
697
-            } catch(PDOException $e) {
697
+            } catch (PDOException $e) {
698 698
                 $result = false;
699 699
                 $this->pushMessage('error', 
700 700
                     __(
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
         if (class_exists('PDO')) {
748 748
             try {
749 749
                 new PDO('sqlite:' . $sqliteFilePath);
750
-            } catch(PDOException $e) { 
750
+            } catch (PDOException $e) { 
751 751
                 $this->pushMessage('error', $e->getMessage());
752 752
                 $result = false;
753 753
             }
@@ -789,10 +789,10 @@  discard block
 block discarded – undo
789 789
                 $redis = new Redis();
790 790
                 $redis->connect(
791 791
                     (string) $this->getConfig('drivers.redis.host'), 
792
-                    (int)    $this->getConfig('drivers.redis.port')
792
+                    (int) $this->getConfig('drivers.redis.port')
793 793
                 );
794 794
                 unset($redis);
795
-            } catch(RedisException $e) {
795
+            } catch (RedisException $e) {
796 796
                 $this->pushMessage('error', $e->getMessage());
797 797
                 $result = false;
798 798
             }
Please login to merge, or discard this patch.
src/Firewall/Driver/SqlDriverProvider.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@
 block discarded – undo
96 96
         return $this->{$method}($ip);
97 97
     }
98 98
 
99
-   /**
99
+    /**
100 100
      * {@inheritDoc}
101 101
      */
102 102
     protected function doFetchAll(string $type = 'filter'): array
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -234,14 +234,14 @@  discard block
 block discarded – undo
234 234
     protected function update(string $table, array $data, array $where)
235 235
     {
236 236
         $placeholder = [];
237
-        foreach($data as $k => $v) {
237
+        foreach ($data as $k => $v) {
238 238
             $placeholder[] = "$k = :$k";
239 239
         }
240 240
 
241 241
         $dataPlaceholder = implode(', ', $placeholder);
242 242
 
243 243
         $placeholder = [];
244
-        foreach($where as $k => $v) {
244
+        foreach ($where as $k => $v) {
245 245
             $placeholder[] = "$k = :$k";
246 246
         }
247 247
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 
254 254
             $bind = array_merge($data, $where);
255 255
     
256
-            foreach($bind as $k => $v) {
256
+            foreach ($bind as $k => $v) {
257 257
 
258 258
                 // @codeCoverageIgnoreStart
259 259
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 
282 282
         // @codeCoverageIgnoreStart
283 283
         
284
-        } catch(Exception $e) {
284
+        } catch (Exception $e) {
285 285
             throw $e->getMessage();
286 286
         }
287 287
 
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
     {
302 302
         $placeholderField = [];
303 303
         $placeholderValue = [];
304
-        foreach($data as $k => $v) {
304
+        foreach ($data as $k => $v) {
305 305
             $placeholderField[] = "`$k`";
306 306
             $placeholderValue[] = ":$k";
307 307
         }
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
             $sql = 'INSERT INTO ' . $table . ' (' . $dataPlaceholderField . ') VALUES (' . $dataPlaceholderValue . ')';
314 314
             $query = $this->db->prepare($sql);
315 315
 
316
-            foreach($data as $k => $v) {
316
+            foreach ($data as $k => $v) {
317 317
 
318 318
                 // @codeCoverageIgnoreStart
319 319
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 
342 342
         // @codeCoverageIgnoreStart
343 343
 
344
-        } catch(Exception $e) {
344
+        } catch (Exception $e) {
345 345
             return false;
346 346
         }
347 347
 
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
     {
361 361
 
362 362
         $placeholder = [];
363
-        foreach($where as $k => $v) {
363
+        foreach ($where as $k => $v) {
364 364
             $placeholder[] = "`$k` = :$k";
365 365
         }
366 366
 
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
             $sql = 'DELETE FROM ' . $table . ' WHERE ' . $dataPlaceholder;
372 372
             $query = $this->db->prepare($sql);
373 373
 
374
-            foreach($where as $k => $v) {
374
+            foreach ($where as $k => $v) {
375 375
 
376 376
                 // @codeCoverageIgnoreStart
377 377
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 
395 395
         // @codeCoverageIgnoreStart
396 396
 
397
-        } catch(Exception $e) {
397
+        } catch (Exception $e) {
398 398
             return false;
399 399
         }
400 400
 
Please login to merge, or discard this patch.
src/Firewall/Driver/SqlTrait.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@
 block discarded – undo
21 21
 trait SqlTrait
22 22
 {
23 23
 /**
24
-     * Fetch data from filter table.
25
-     *
26
-     * @param string $ip An IP address.
27
-     *
28
-     * @return array
29
-     */
24
+ * Fetch data from filter table.
25
+ *
26
+ * @param string $ip An IP address.
27
+ *
28
+ * @return array
29
+ */
30 30
     protected function doFetchFromFilterTable(string $ip): array
31 31
     {
32 32
         $results = [];
Please login to merge, or discard this patch.