Passed
Push — master ( 87f610...286eca )
by Plamen
02:07
created
table.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@  discard block
 block discarded – undo
25 25
     public static function prepare($setOrCheck = false)
26 26
     {
27 27
         //@see  http://php.net/manual/es/function.filter-input.php#77307
28
-        $uri = filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_URL) ?:
29
-                filter_var($_SERVER['REQUEST_URI'], FILTER_SANITIZE_URL);
28
+        $uri = filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_URL) ?: filter_var($_SERVER['REQUEST_URI'], FILTER_SANITIZE_URL);
30 29
 
31 30
         $extension = pathinfo(strtok($uri, '?'), PATHINFO_EXTENSION);
32 31
 
@@ -79,7 +78,7 @@  discard block
 block discarded – undo
79 78
 
80 79
         $filter = self::requestFilter();
81 80
         $order = [self::$t['order']['col'] => self::$t['order']['dir']];
82
-        $offset = (self::$t['page'] - 1) * self::$t['paging'];
81
+        $offset = (self::$t['page'] - 1)*self::$t['paging'];
83 82
         $limit = [$offset, self::$t['paging']];
84 83
         self::$t['q'] = self::q($q, $filter, $order, $limit, true);
85 84
 
Please login to merge, or discard this patch.
trait_tfoot_paging.php 1 patch
Spacing   +8 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,13 +14,12 @@  discard block
 block discarded – undo
14 14
 
15 15
             $limit = 10;
16 16
 
17
-            $v['start'] = $v['page'] > ($limit / 2) ?
18
-                    ($v['page'] - $limit / 2) :
19
-                    1;
17
+            $v['start'] = $v['page'] > ($limit/2) ?
18
+                    ($v['page'] - $limit/2) : 1;
20 19
 
21
-            if ($v['page'] > ($v['pages'] - ($limit / 2))) {
20
+            if ($v['page'] > ($v['pages'] - ($limit/2))) {
22 21
                 $v['final'] = $v['pages'];
23
-            } else if ($v['page'] > ($limit / 2)) {
22
+            } else if ($v['page'] > ($limit/2)) {
24 23
                 $v['final'] = $v['start'] + $limit;
25 24
             } else {
26 25
                 $v['final'] = $limit;
@@ -44,12 +43,11 @@  discard block
 block discarded – undo
44 43
         $add = '<li class="jump"><a>' . self::jumps($m, $direction) . '</a></li>';
45 44
 
46 45
         $jump_exists = $direction === '-' ?
47
-                        (self::$t['page'] - $m) > 0 :
48
-                        (self::$t['page'] + $m) <= self::$t['pages'];
46
+                        (self::$t['page'] - $m) > 0 : (self::$t['page'] + $m) <= self::$t['pages'];
49 47
 
50 48
         if ($jump_exists) {
51 49
             $html = $direction === '-' ? $add . $html : $html . $add;
52
-            return self::pagingJumps($html, ($m * 10));
50
+            return self::pagingJumps($html, ($m*10));
53 51
         }
54 52
 
55 53
         return $html;
@@ -58,9 +56,9 @@  discard block
 block discarded – undo
58 56
     private static function jumps($m, $direction)
59 57
     {
60 58
         if ($m >= 1000000) {
61
-            return ($direction . ($m / 1000000) . "M");
59
+            return ($direction . ($m/1000000) . "M");
62 60
         } else if ($m >= 1000) {
63
-            return ($direction . ($m / 1000) . "K");
61
+            return ($direction . ($m/1000) . "K");
64 62
         } else {
65 63
             return ($direction . $m);
66 64
         }
Please login to merge, or discard this patch.
tbody.php 1 patch
Spacing   +4 added lines, -7 removed lines patch added patch discarded remove patch
@@ -48,16 +48,14 @@  discard block
 block discarded – undo
48 48
         $rows = [$header];
49 49
 
50 50
         $data = self::$exportDataAsDisplayed ?
51
-                self::$data :
52
-                self::select(self::$t['q']);
51
+                self::$data : self::select(self::$t['q']);
53 52
 
54 53
         if (count($data) > 0) {
55 54
             foreach ($data as $row) {
56 55
                 $cells = [];
57
-                foreach($columns as $column){
56
+                foreach ($columns as $column) {
58 57
                     $cells[] = is_array($row[$column]) ? 
59
-                                $row[$column][0] :
60
-                                $row[$column];
58
+                                $row[$column][0] : $row[$column];
61 59
                 }
62 60
                 $rows[] = $cells;
63 61
             }
@@ -95,8 +93,7 @@  discard block
 block discarded – undo
95 93
                 if (($output = fopen('php://output', 'w'))) {
96 94
                     foreach ($eData as $v) {
97 95
                         self::$export === 'CSV' ?
98
-                                        fputcsv($output, $v) :
99
-                                        fputs($output, implode("\t", array_map($escape, $v)) . "\r\n");
96
+                                        fputcsv($output, $v) : fputs($output, implode("\t", array_map($escape, $v)) . "\r\n");
100 97
                     }
101 98
                     fclose($output);
102 99
                 }
Please login to merge, or discard this patch.
tfoot.php 1 patch
Spacing   +6 added lines, -8 removed lines patch added patch discarded remove patch
@@ -38,12 +38,11 @@  discard block
 block discarded – undo
38 38
             $q = 'SELECT COUNT(*) FROM (' . self::$t['qAll'] . ') AS dt';
39 39
             self::$t['rows'] = self::select($q);
40 40
         }
41
-        self::$t['pages'] = ceil(self::$t['rows'] / self::$t['paging']);
41
+        self::$t['pages'] = ceil(self::$t['rows']/self::$t['paging']);
42 42
 
43
-        $v['from'] = ($pageNo - 1) * self::$t['paging'] + 1;
44
-        $v['upto'] = ($pageNo * self::$t['paging'] < self::$t['rows']) ?
45
-                $pageNo * self::$t['paging'] :
46
-                self::$t['rows'];
43
+        $v['from'] = ($pageNo - 1)*self::$t['paging'] + 1;
44
+        $v['upto'] = ($pageNo*self::$t['paging'] < self::$t['rows']) ?
45
+                $pageNo*self::$t['paging'] : self::$t['rows'];
47 46
 
48 47
         $v["total"] = self::$t['rows'];
49 48
         $v["items"] = self::$t['items'];
@@ -69,9 +68,8 @@  discard block
 block discarded – undo
69 68
             $select = static::$select;
70 69
             $res = $select($expression, $bindings);
71 70
             //if result is single cell value ($res[0]->value), return the value
72
-            return (count($res) === 1 && count((array) $res[0]) === 1) ?
73
-                    reset($res[0]) :
74
-                    $res;
71
+            return (count($res) === 1 && count((array)$res[0]) === 1) ?
72
+                    reset($res[0]) : $res;
75 73
         } else {
76 74
             throw new Exception('ERROR: table::$select is not a closure. ');
77 75
         }
Please login to merge, or discard this patch.
thead.php 1 patch
Spacing   +4 added lines, -7 removed lines patch added patch discarded remove patch
@@ -46,8 +46,7 @@  discard block
 block discarded – undo
46 46
     private static function tagAttributes($tag, $items)
47 47
     {
48 48
         $attr = $tag === 'div' ?
49
-                ['id' => $items . '-list', 'class' => 'table'] :
50
-                ['id' => $items . '-table', 'data-table' => 'js', 
49
+                ['id' => $items . '-list', 'class' => 'table'] : ['id' => $items . '-table', 'data-table' => 'js', 
51 50
                 'data-sort-a' => self::config('UTF8_ASC_SYMBOL'),
52 51
                 'data-sort-d' => self::config('UTF8_DESC_SYMBOL')];
53 52
         if (array_key_exists($tag, self::$attributes)) {
@@ -84,8 +83,7 @@  discard block
 block discarded – undo
84 83
         if (isset($arg['width'])) { // Width attribute -> style
85 84
             $width = 'width:' . $arg['width'] . ';';
86 85
             $arg['style'] = isset($arg['style']) ?
87
-                    $width . $arg['style'] :
88
-                    $width;
86
+                    $width . $arg['style'] : $width;
89 87
         }
90 88
 
91 89
         if (($del = isset($arg['type']) && $arg['type'] == 'delete')) {
@@ -94,7 +92,7 @@  discard block
 block discarded – undo
94 92
             $sort = isset($arg['sort']) ? $arg['sort'] : $col;
95 93
         }
96 94
 
97
-        return array_diff_key((array) $arg, ['sort', 'type', 'width']);
95
+        return array_diff_key((array)$arg, ['sort', 'type', 'width']);
98 96
     }
99 97
 
100 98
     private static function th($i, $attr, $sort, $del, $lbl)
@@ -106,8 +104,7 @@  discard block
 block discarded – undo
106 104
         if (!$del) {
107 105
             if ($sort == self::$t['order']['col']) {
108 106
                 $span = self::$t['order']['dir'] === 'desc' ?
109
-                        self::config('UTF8_DESC_SYMBOL') :
110
-                        self::config('UTF8_ASC_SYMBOL');
107
+                        self::config('UTF8_DESC_SYMBOL') : self::config('UTF8_ASC_SYMBOL');
111 108
             } else {
112 109
                 $span = "";
113 110
             }
Please login to merge, or discard this patch.
trait_table_request.php 1 patch
Spacing   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -38,8 +38,7 @@  discard block
 block discarded – undo
38 38
     {
39 39
         if (($col = filter_input(INPUT_GET, 'col', FILTER_VALIDATE_INT))) {
40 40
             return isset(self::$cols[$col][2]['sort']) ?
41
-                    self::$cols[$col][2]['sort'] :
42
-                    self::$cols[$col][1];
41
+                    self::$cols[$col][2]['sort'] : self::$cols[$col][1];
43 42
         }
44 43
         return self::$t['order']['col'];
45 44
     }
@@ -48,8 +47,7 @@  discard block
 block discarded – undo
48 47
     {
49 48
         $reset = filter_has_var(INPUT_GET, 'col') ? 'asc' : null;
50 49
         return in_array(filter_input(INPUT_GET, 'ord'), ['asc', 'desc']) ?
51
-                filter_input(INPUT_GET, 'ord') :
52
-                ($reset ?: self::$t['order']['dir']);
50
+                filter_input(INPUT_GET, 'ord') : ($reset ?: self::$t['order']['dir']);
53 51
     }
54 52
 
55 53
     private static function requestExport()
@@ -61,7 +59,6 @@  discard block
 block discarded – undo
61 59
     private static function requestPage()
62 60
     {
63 61
         return filter_has_var(INPUT_GET, 'pg') && self::$export == false ?
64
-                (int)filter_input(INPUT_GET, 'pg', FILTER_SANITIZE_NUMBER_INT) :
65
-                self::$t['page'];
62
+                (int)filter_input(INPUT_GET, 'pg', FILTER_SANITIZE_NUMBER_INT) : self::$t['page'];
66 63
     }
67 64
 }
Please login to merge, or discard this patch.