Passed
Branchmaster (1bd863)
by Plamen
01:24
created
trait_table_request.php 1 patch
Spacing   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,8 +37,7 @@  discard block
 block discarded – undo
37 37
     {
38 38
         if (($col = filter_input(INPUT_GET, 'col', FILTER_VALIDATE_INT))) {
39 39
             return isset(self::$cols[$col][2]['sort']) ?
40
-                    self::$cols[$col][2]['sort'] :
41
-                    self::$cols[$col][1];
40
+                    self::$cols[$col][2]['sort'] : self::$cols[$col][1];
42 41
         }
43 42
         return self::$t['order']['col'];
44 43
     }
@@ -47,8 +46,7 @@  discard block
 block discarded – undo
47 46
     {
48 47
         $reset = filter_has_var(INPUT_GET, 'col') ? 'asc' : null;
49 48
         return in_array(filter_input(INPUT_GET, 'ord'), ['asc', 'desc']) ?
50
-                filter_input(INPUT_GET, 'ord') :
51
-                ($reset ?: self::$t['order']['dir']);
49
+                filter_input(INPUT_GET, 'ord') : ($reset ?: self::$t['order']['dir']);
52 50
     }
53 51
 
54 52
     private static function requestExport()
@@ -60,7 +58,6 @@  discard block
 block discarded – undo
60 58
     private static function requestPage()
61 59
     {
62 60
         return filter_has_var(INPUT_GET, 'pg') && self::$export == false ?
63
-                (int) filter_input(INPUT_GET, 'pg', FILTER_SANITIZE_NUMBER_INT) :
64
-                self::$t['page'];
61
+                (int)filter_input(INPUT_GET, 'pg', FILTER_SANITIZE_NUMBER_INT) : self::$t['page'];
65 62
     }
66 63
 }
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
@@ -22,8 +22,7 @@  discard block
 block discarded – undo
22 22
                 $sortable = !isset($arg['sort']) || $arg['sort'] !== false;
23 23
 
24 24
                 $sort = $sortable ?
25
-                        (isset($arg['sort']) ? $arg['sort'] : $col) :
26
-                        null;
25
+                        (isset($arg['sort']) ? $arg['sort'] : $col) : null;
27 26
 
28 27
                 if (($del = isset($arg['type']) && $arg['type'] == 'delete')) {
29 28
                     $sortable = false;
@@ -37,11 +36,10 @@  discard block
 block discarded – undo
37 36
                 if (isset($arg['width'])) { // Width attribute -> style
38 37
                     $width = 'width:' . $arg['width'] . ';';
39 38
                     $arg['style'] = isset($arg['style']) ?
40
-                            $width . $arg['style'] :
41
-                            $width;
39
+                            $width . $arg['style'] : $width;
42 40
                 }
43 41
 
44
-                $attr = array_diff_key((array) $arg, ['sort', 'type', 'width']);
42
+                $attr = array_diff_key((array)$arg, ['sort', 'type', 'width']);
45 43
 
46 44
                 $th = '<th' . self::attributes($attr) . '>';
47 45
                 if ($sortable) {
@@ -50,8 +48,7 @@  discard block
 block discarded – undo
50 48
                 if (!$del) {
51 49
                     if ($sort == self::$t['order']['col']) {
52 50
                         $span = self::$t['order']['dir'] === 'desc' ?
53
-                                self::config('UTF8_DESC_SYMBOL') :
54
-                                self::config('UTF8_ASC_SYMBOL');
51
+                                self::config('UTF8_DESC_SYMBOL') : self::config('UTF8_ASC_SYMBOL');
55 52
                     } else {
56 53
                         $span = "";
57 54
                     }
Please login to merge, or discard this patch.
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   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,8 +44,7 @@  discard block
 block discarded – undo
44 44
     protected static function export()
45 45
     {
46 46
         $data = self::$exportDataAsDisplayed ?
47
-                self::$data :
48
-                self::select(self::$t['q']);
47
+                self::$data : self::select(self::$t['q']);
49 48
         $fnReplace = [];
50 49
         $fnReplace[':app'] = self::config('APP');
51 50
         $fnReplace[':items'] = self::$t['items'];
@@ -91,8 +90,7 @@  discard block
 block discarded – undo
91 90
                 if (($output = fopen('php://output', 'w'))) {
92 91
                     foreach ($eData as $v) {
93 92
                         self::$export === 'CSV' ?
94
-                                        fputcsv($output, $v) :
95
-                                        fputs($output, implode("\t", array_map($escape, $v)) . "\r\n");
93
+                                        fputcsv($output, $v) : fputs($output, implode("\t", array_map($escape, $v)) . "\r\n");
96 94
                     }
97 95
                     fclose($output);
98 96
                 }
Please login to merge, or discard this patch.
tfoot.php 1 patch
Spacing   +8 added lines, -10 removed lines patch added patch discarded remove patch
@@ -21,14 +21,13 @@  discard block
 block discarded – undo
21 21
                 $q = 'SELECT COUNT(*) FROM (' . self::$t['qAll'] . ') AS dt';
22 22
                 self::$t['rows'] = self::select($q);
23 23
             }
24
-            self::$t['pages'] = ceil(self::$t['rows'] / self::$t['paging']);
24
+            self::$t['pages'] = ceil(self::$t['rows']/self::$t['paging']);
25 25
 
26 26
             $v = [];
27 27
 
28
-            $v['from'] = ($pageNo - 1) * self::$t['paging'] + 1;
29
-            $v['upto'] = ($pageNo * self::$t['paging'] < self::$t['rows']) ?
30
-                    $pageNo * self::$t['paging'] :
31
-                    self::$t['rows'];
28
+            $v['from'] = ($pageNo - 1)*self::$t['paging'] + 1;
29
+            $v['upto'] = ($pageNo*self::$t['paging'] < self::$t['rows']) ?
30
+                    $pageNo*self::$t['paging'] : self::$t['rows'];
32 31
 
33 32
             $v["total"] = self::$t['rows'];
34 33
             $v["items"] = self::$t['items'];
@@ -56,9 +55,8 @@  discard block
 block discarded – undo
56 55
             $select = static::$select;
57 56
             $res = $select($expression, $bindings);
58 57
             //if result is single cell value ($res[0]->value), return the value
59
-            return (count($res) === 1 && count((array) $res[0]) === 1) ?
60
-                    reset($res[0]) :
61
-                    $res;
58
+            return (count($res) === 1 && count((array)$res[0]) === 1) ?
59
+                    reset($res[0]) : $res;
62 60
         } else {
63 61
             throw new Exception('ERROR: table::$select is not a closure. ');
64 62
         }
@@ -71,8 +69,8 @@  discard block
 block discarded – undo
71 69
             $ftr = self::jsonGetFooterData()[0][0];
72 70
             $trs .= '<tr><td' . self::attributes($ftr[1]) . '>'
73 71
                     . $ftr[0] . '</td></tr>';
74
-        } else if(count(self::$errors)>0) {
75
-            $trs .= '<tr><td colspan="'.count(self::$cols).'">' . 
72
+        } else if (count(self::$errors) > 0) {
73
+            $trs .= '<tr><td colspan="' . count(self::$cols) . '">' . 
76 74
                     self::err() . '</td></tr>';
77 75
         }
78 76
         return $trs;
Please login to merge, or discard this patch.
trait_tfoot_setter.php 1 patch
Spacing   +5 added lines, -7 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
             switch (gettype($c)) {
63 63
                 case 'array';
64 64
                     foreach ($c as $k => $v) {
65
-                        self::$config[$k] = $getValid((string) $k, $v);
65
+                        self::$config[$k] = $getValid((string)$k, $v);
66 66
                     }
67 67
                     break;
68 68
                 case 'string':
@@ -86,8 +86,7 @@  discard block
 block discarded – undo
86 86
     {
87 87
         //Condition: '' | '(HAVING|WHERE|AND) ' . $cond
88 88
         $c = !empty($cond) && !strpos($q, ($cl = !$h ? 'WHERE' : 'HAVING')) ?
89
-                (' ' . (!strpos($q, $cl) ? $cl : ' AND ') . ' ' . $cond ) :
90
-                '';
89
+                (' ' . (!strpos($q, $cl) ? $cl : ' AND ') . ' ' . $cond) : '';
91 90
         //Order: '' | 'ORDER BY ' . array_keys($order)[0] . ' ' . $order[0]
92 91
         $o = !empty($order) ?
93 92
                 ' ORDER BY ' . implode(', ',
@@ -98,8 +97,7 @@  discard block
 block discarded – undo
98 97
                 '';
99 98
         //Limit: '' | ' LIMIT ' . '(20, 40|20)'
100 99
         $l = !empty($limit) ?
101
-                (' LIMIT ' . (is_array($limit) ? implode(', ', $limit) : $limit)) :
102
-                '';
100
+                (' LIMIT ' . (is_array($limit) ? implode(', ', $limit) : $limit)) : '';
103 101
 
104 102
         return $q . $c . $o . $l;
105 103
     }
@@ -122,7 +120,7 @@  discard block
 block discarded – undo
122 120
         $list = [];
123 121
         foreach ($attributes as $key => $value) {
124 122
             if (is_bool($value)) {
125
-                if ((bool) $value) {
123
+                if ((bool)$value) {
126 124
                     $list[] = $key;
127 125
                 }
128 126
             } else if (empty($value) && !is_int($value)) {
@@ -143,6 +141,6 @@  discard block
 block discarded – undo
143 141
         extract($vars);
144 142
         ob_start();
145 143
         require $template;
146
-        return (string) ob_get_clean();
144
+        return (string)ob_get_clean();
147 145
     }
148 146
 }
Please login to merge, or discard this patch.