Completed
Push — master ( 6d16be...447129 )
by Adam
01:55
created
src/Pagination.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -74,10 +74,8 @@
 block discarded – undo
74 74
             self::$page = (self::$current > $show ? (self::$current - $show) : 1);
75 75
             if (self::$current < (self::$lastpage - $show)) {
76 76
                 self::$lastpage = ((self::$current <= $show) ? (self::$current + ($numpages - self::$current)) : (self::$current + $show));
77
-            }
78
-            else { self::$page = self::$current - ($numpages - ((ceil($records / $maxshown) - self::$current)) - 1); }
79
-        }
80
-        else { self::$page = 1; }
77
+            } else { self::$page = self::$current - ($numpages - ((ceil($records / $maxshown) - self::$current)) - 1); }
78
+        } else { self::$page = 1; }
81 79
     }
82 80
     
83 81
     /**
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
      * @param string $class This should be the class or classes that you wish to give to the pagination object 
18 18
      * @return $this
19 19
      */
20
-    public function setPaginationClass($class){
21
-        if((!empty(trim($class)))){
20
+    public function setPaginationClass($class) {
21
+        if ((!empty(trim($class)))) {
22 22
             $this->pagerClass = $class;
23 23
         }
24 24
         return $this;
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      * Returns the class to give to the pagination object
29 29
      * @return type
30 30
      */
31
-    public function getPaginationClass(){
31
+    public function getPaginationClass() {
32 32
         return $this->pagerClass;
33 33
     }
34 34
     
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
      * @param string $class This should be the class to assign on active elements
38 38
      * @return $this
39 39
      */
40
-    public function setActiveClass($class){
41
-        if((!empty(trim($class)))){
40
+    public function setActiveClass($class) {
41
+        if ((!empty(trim($class)))) {
42 42
             $this->liActiveClass = $class;
43 43
         }
44 44
         return $this;
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      * Returns the class to assign to active li elements
49 49
      * @return string $class This should be the class to assign on active elements
50 50
      */
51
-    public function getActiveClass(){
51
+    public function getActiveClass() {
52 52
         return $this->liActiveClass;
53 53
     }
54 54
     
Please login to merge, or discard this patch.
tests/PaginationTest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 use Pager\Pagination;
5 5
 use PHPUnit\Framework\TestCase;
6 6
 
7
-class PaginationTest extends TestCase{
7
+class PaginationTest extends TestCase {
8 8
     
9 9
     protected $pagination;
10 10
     
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
         $this->pagination = new Pagination();
13 13
     }
14 14
     
15
-    public function tearDown(){
15
+    public function tearDown() {
16 16
         unset($this->pagination);
17 17
     }
18 18
     
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      * @covers Pager\Pagination::postLinks
27 27
      * @covers Pager\Pagination::preLinks
28 28
      */
29
-    public function testCreatePager(){
29
+    public function testCreatePager() {
30 30
         $pager = $this->pagination->paging(106, '/test-page');
31 31
         $this->assertStringStartsWith("<ul", $pager);
32 32
         $this->assertStringEndsWith("ul>", $pager);
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      * @covers Pager\Pagination::postLinks
47 47
      * @covers Pager\Pagination::preLinks
48 48
      */
49
-    public function testNoPagerNeeded(){
49
+    public function testNoPagerNeeded() {
50 50
         $this->assertFalse($this->pagination->paging(10, '/test-page'));
51 51
     }
52 52
     
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      * @covers Pager\Pagination::postLinks
61 61
      * @covers Pager\Pagination::preLinks
62 62
      */
63
-    public function testPagerArrows(){
63
+    public function testPagerArrows() {
64 64
         $this->markTestIncomplete('Test not yet implemented');
65 65
     }
66 66
     
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      * @covers Pager\Pagination::postLinks
75 75
      * @covers Pager\Pagination::preLinks
76 76
      */
77
-    public function testPagerWithQueryString(){
77
+    public function testPagerWithQueryString() {
78 78
         $this->markTestIncomplete('Test not yet implemented');
79 79
     }
80 80
     
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      * @covers Pager\Pagination::setPaginationClass
83 83
      * @covers Pager\Pagination::getPaginationClass
84 84
      */
85
-    public function testSetPagerClass(){
85
+    public function testSetPagerClass() {
86 86
         $this->assertEquals('pagination', $this->pagination->getPaginationClass());
87 87
         $this->pagination->setPaginationClass('my-class');
88 88
         $this->assertNotEquals('pagination', $this->pagination->getPaginationClass());
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
      * @covers Pager\Pagination::setActiveClass
96 96
      * @covers Pager\Pagination::getActiveClass
97 97
      */
98
-    public function testSetActiveClass(){
98
+    public function testSetActiveClass() {
99 99
         $this->assertEquals('active', $this->pagination->getActiveClass());
100 100
         $this->pagination->setActiveClass('current');
101 101
         $this->assertNotEquals('active', $this->pagination->getActiveClass());
Please login to merge, or discard this patch.