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