Passed
Push — master ( d5c329...413b55 )
by Adam
02:40
created
src/Pagination.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
     
53 53
     /**
54 54
      * Builds the query string to add to the URL
55
-     * @param mixed $page If the page variable is set to a number will add the page number to the query string else will not add any additional items
55
+     * @param string $page If the page variable is set to a number will add the page number to the query string else will not add any additional items
56 56
      * @return string The complete string will be returned to add to the link item
57 57
      */
58 58
     protected function buildQueryString($page){
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -28,13 +28,13 @@  discard block
 block discarded – undo
28 28
             self::$lastpage = ceil($records / $maxshown);
29 29
             
30 30
             self::getPage($records, $maxshown, $numpagesshown);
31
-            $paging = '<ul class="pagination">' . $this->preLinks($arrows);
31
+            $paging = '<ul class="pagination">'.$this->preLinks($arrows);
32 32
   
33 33
             while (self::$page <= self::$lastpage) {
34 34
                 $paging .= $this->buildLink(self::$page, self::$page, (self::$current == self::$page));
35 35
                 self::$page = (self::$page + 1);
36 36
             }
37
-            return $paging . $this->postLinks($arrows) . '</ul>';
37
+            return $paging.$this->postLinks($arrows).'</ul>';
38 38
         }
39 39
         return false;
40 40
     }
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      * @param boolean $current If this is the current link item set this as true so the class is added to the link item
47 47
      * @return string This will return the paging item as a string
48 48
      */
49
-    protected function buildLink($link, $page, $current = false){
49
+    protected function buildLink($link, $page, $current = false) {
50 50
         return '<li'.($current === true ? ' class="active"' : '').'><a href="'.self::$pageURL.'?'.$this->buildQueryString($link).'">'.$page.'</a></li>';
51 51
     }
52 52
     
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
      * @param mixed $page If the page variable is set to a number will add the page number to the query string else will not add any additional items
56 56
      * @return string The complete string will be returned to add to the link item
57 57
      */
58
-    protected function buildQueryString($page){
59
-        if(is_numeric($page)){
58
+    protected function buildQueryString($page) {
59
+        if (is_numeric($page)) {
60 60
             $this->queryString['page'] = $page;
61 61
         }
62 62
         return http_build_query(array_filter($this->queryString));
@@ -72,13 +72,13 @@  discard block
 block discarded – undo
72 72
     protected static function getPage($records, $maxshown, $numpages) {
73 73
         $show = floor($numpages / 2);
74 74
         if (self::$lastpage > $numpages) {
75
-            if (self::$current > $show) { self::$page = self::$current - $show; } else { self::$page = 1; }
75
+            if (self::$current > $show) { self::$page = self::$current - $show; }else { self::$page = 1; }
76 76
 
77 77
             if (self::$current < (self::$lastpage - $show)) {
78 78
                 self::$lastpage = self::$current + $show;
79 79
                 if (self::$current <= $show) { self::$lastpage = self::$current + ($numpages - self::$current); }
80
-            } else { self::$page = self::$current - ($numpages - ((ceil($records / $maxshown) - self::$current)) - 1); }
81
-        } else { self::$page = 1; }
80
+            }else { self::$page = self::$current - ($numpages - ((ceil($records / $maxshown) - self::$current)) - 1); }
81
+        }else { self::$page = 1; }
82 82
     }
83 83
     
84 84
     /**
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      * @param boolean $arrows If you want to display previous arrows set to true else set to false
87 87
      * @return string Any previous link arrows will be returned as a string
88 88
      */
89
-    protected function preLinks($arrows = true){
89
+    protected function preLinks($arrows = true) {
90 90
         $paging = '';
91 91
         if (self::$current != 1 && $arrows) {
92 92
             if (self::$current != 2) { $paging .= $this->buildLink('', '&laquo;'); }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      * @param boolean $arrows If you want to display next arrows set to true else set to false
101 101
      * @return string Any next link arrows will be returned as a string
102 102
      */
103
-    protected function postLinks($arrows = true){
103
+    protected function postLinks($arrows = true) {
104 104
         $paging = '';
105 105
         if (self::$current != self::$lastpage && $arrows) {
106 106
             $paging .= $this->buildLink((self::$current + 1), '&gt;');
Please login to merge, or discard this patch.