Test Setup Failed
Push — master ( 87bc38...9d57f0 )
by Adam
02:41
created
src/pagination.php 2 patches
Braces   +5 added lines, -7 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public static function paging($records, $pageURL, $start = 0, $additional = '', $maxshown = 50, $numpagesshown = 11){
25 25
         if($records > $maxshown){
26
-            if($start >= 1){self::$current = $start;}else{self::$current = 1;}
26
+            if($start >= 1){self::$current = $start;} else{self::$current = 1;}
27 27
             self::$lastpage = ceil($records / $maxshown);
28 28
             
29 29
             if(!empty($additional)){$additional = 'search='.$additional.'&';}
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
                 $paging.= '<li><a href="'.$pageURL.'?'.$additional.'page='.($start - 1).'">&lt;</a></li>';
36 36
             }
37 37
             while(self::$page <= self::$lastpage){
38
-                if(self::$current == self::$page){$curselect = ' class="active"';}else{$curselect = '';}
38
+                if(self::$current == self::$page){$curselect = ' class="active"';} else{$curselect = '';}
39 39
                 $paging.= '<li'.$curselect.'><a href="'.$pageURL.'?'.$additional.'page='.self::$page.'">'.self::$page.'</a></li>';
40 40
                 self::$page = (self::$page + 1);
41 41
             }
@@ -58,14 +58,12 @@  discard block
 block discarded – undo
58 58
     protected static function getPage($records, $maxshown, $numpages){
59 59
         $show = floor($numpages / 2);
60 60
         if(self::$lastpage > $numpages){
61
-            if(self::$current > $show){self::$page = self::$current - $show;}else{self::$page = 1;}
61
+            if(self::$current > $show){self::$page = self::$current - $show;} else{self::$page = 1;}
62 62
 
63 63
             if(self::$current < (self::$lastpage - $show)){
64 64
                 self::$lastpage = self::$current + $show;
65 65
                 if(self::$current <= $show){self::$lastpage = self::$current + ($numpages - self::$current);}
66
-            }
67
-            else{self::$page = self::$current - ($numpages - ((ceil($records / $maxshown) - self::$current)) - 1);}
68
-        }
69
-        else{self::$page = 1;}
66
+            } else{self::$page = self::$current - ($numpages - ((ceil($records / $maxshown) - self::$current)) - 1);}
67
+        } else{self::$page = 1;}
70 68
     }
71 69
 }
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  *
6 6
  * @author Adam Binnersley <[email protected]>
7 7
  */
8
-class Pagination{
8
+class Pagination {
9 9
     
10 10
     public static $current;
11 11
     protected static $page;
@@ -21,29 +21,29 @@  discard block
 block discarded – undo
21 21
      * @param int $numpagesshown The number of pagination buttons to display
22 22
      * @return string Returns the pagination menu
23 23
      */
24
-    public static function paging($records, $pageURL, $start = 0, $additional = '', $maxshown = 50, $numpagesshown = 11){
25
-        if($records > $maxshown){
26
-            if($start >= 1){self::$current = $start;}else{self::$current = 1;}
24
+    public static function paging($records, $pageURL, $start = 0, $additional = '', $maxshown = 50, $numpagesshown = 11) {
25
+        if ($records > $maxshown) {
26
+            if ($start >= 1) {self::$current = $start; }else {self::$current = 1; }
27 27
             self::$lastpage = ceil($records / $maxshown);
28 28
             
29
-            if(!empty($additional)){$additional = 'search='.$additional.'&amp;';}
29
+            if (!empty($additional)) {$additional = 'search='.$additional.'&amp;'; }
30 30
             
31 31
             self::getPage($records, $maxshown, $numpagesshown);
32 32
             $paging = '<ul class="pagination">';
33
-            if(self::$current != 1){
34
-                if(self::$current != 2){$paging.= '<li><a href="'.$pageURL.'?'.$additional.'">&laquo;</a></li>';}
35
-                $paging.= '<li><a href="'.$pageURL.'?'.$additional.'page='.($start - 1).'">&lt;</a></li>';
33
+            if (self::$current != 1) {
34
+                if (self::$current != 2) {$paging .= '<li><a href="'.$pageURL.'?'.$additional.'">&laquo;</a></li>'; }
35
+                $paging .= '<li><a href="'.$pageURL.'?'.$additional.'page='.($start - 1).'">&lt;</a></li>';
36 36
             }
37
-            while(self::$page <= self::$lastpage){
38
-                if(self::$current == self::$page){$curselect = ' class="active"';}else{$curselect = '';}
39
-                $paging.= '<li'.$curselect.'><a href="'.$pageURL.'?'.$additional.'page='.self::$page.'">'.self::$page.'</a></li>';
37
+            while (self::$page <= self::$lastpage) {
38
+                if (self::$current == self::$page) {$curselect = ' class="active"'; }else {$curselect = ''; }
39
+                $paging .= '<li'.$curselect.'><a href="'.$pageURL.'?'.$additional.'page='.self::$page.'">'.self::$page.'</a></li>';
40 40
                 self::$page = (self::$page + 1);
41 41
             }
42
-            if(self::$current != self::$lastpage){
43
-                $paging.= '<li><a href="'.$pageURL.'?'.$additional.'page='.($start + 1).'">&gt;</a></li>';
44
-                if(self::$current != (self::$lastpage - 1)){$paging.= '<li><a href="'.$pageURL.'?'.$additional.'page='.ceil($records / $maxshown).'">&raquo;</a></li>';}
42
+            if (self::$current != self::$lastpage) {
43
+                $paging .= '<li><a href="'.$pageURL.'?'.$additional.'page='.($start + 1).'">&gt;</a></li>';
44
+                if (self::$current != (self::$lastpage - 1)) {$paging .= '<li><a href="'.$pageURL.'?'.$additional.'page='.ceil($records / $maxshown).'">&raquo;</a></li>'; }
45 45
             }
46
-            $paging.= '</ul>';
46
+            $paging .= '</ul>';
47 47
             return $paging;
48 48
         }
49 49
         return false;
@@ -56,17 +56,17 @@  discard block
 block discarded – undo
56 56
      * @param int $numpages The number of pagination buttons to display
57 57
      * return void Nothing is returned
58 58
      */
59
-    protected static function getPage($records, $maxshown, $numpages){
59
+    protected static function getPage($records, $maxshown, $numpages) {
60 60
         $show = floor($numpages / 2);
61
-        if(self::$lastpage > $numpages){
62
-            if(self::$current > $show){self::$page = self::$current - $show;}else{self::$page = 1;}
61
+        if (self::$lastpage > $numpages) {
62
+            if (self::$current > $show) {self::$page = self::$current - $show; }else {self::$page = 1; }
63 63
 
64
-            if(self::$current < (self::$lastpage - $show)){
64
+            if (self::$current < (self::$lastpage - $show)) {
65 65
                 self::$lastpage = self::$current + $show;
66
-                if(self::$current <= $show){self::$lastpage = self::$current + ($numpages - self::$current);}
66
+                if (self::$current <= $show) {self::$lastpage = self::$current + ($numpages - self::$current); }
67 67
             }
68
-            else{self::$page = self::$current - ($numpages - ((ceil($records / $maxshown) - self::$current)) - 1);}
68
+            else {self::$page = self::$current - ($numpages - ((ceil($records / $maxshown) - self::$current)) - 1); }
69 69
         }
70
-        else{self::$page = 1;}
70
+        else {self::$page = 1; }
71 71
     }
72 72
 }
Please login to merge, or discard this patch.