Passed
Push — master ( 02934f...b45d6c )
by Eric
01:51
created
tests/PaginatorTest.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
             ->setItemsPerPage(10)
84 84
             ->setPagesInRange(5);
85 85
 
86
-        $paginator->setItemTotalCallback(static function (): int {
86
+        $paginator->setItemTotalCallback(static function(): int {
87 87
             /** @var \PDOStatement $result */
88 88
             $result = self::$dbObj->query("SELECT COUNT(*) as totalCount FROM facts");
89 89
             $row    = $result->fetchColumn();
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         });
92 92
 
93 93
         // Pass our slice callback.
94
-        $paginator->setSliceCallback(static function (int $offset, int $length): array {
94
+        $paginator->setSliceCallback(static function(int $offset, int $length): array {
95 95
             /** @var \PDOStatement $result */
96 96
             $result     = self::$dbObj->query(sprintf('SELECT name, area FROM facts ORDER BY area DESC LIMIT %d, %d', $offset, $length), PDO::FETCH_ASSOC);
97 97
             $collection = [];
@@ -326,12 +326,12 @@  discard block
 block discarded – undo
326 326
         ]);
327 327
 
328 328
         $beforeQueryFired = false;
329
-        $paginator->setBeforeQueryCallback(static function () use (&$beforeQueryFired): void {
329
+        $paginator->setBeforeQueryCallback(static function() use (&$beforeQueryFired): void {
330 330
             $beforeQueryFired = true;
331 331
         });
332 332
 
333 333
         $afterQueryFired = false;
334
-        $paginator->setAfterQueryCallback(static function () use (&$afterQueryFired): void {
334
+        $paginator->setAfterQueryCallback(static function() use (&$afterQueryFired): void {
335 335
             $afterQueryFired = true;
336 336
         });
337 337
 
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
         ]);
355 355
 
356 356
         $beforeQueryFired = false;
357
-        $paginator->setBeforeQueryCallback(static function () use (&$beforeQueryFired): void {
357
+        $paginator->setBeforeQueryCallback(static function() use (&$beforeQueryFired): void {
358 358
             $beforeQueryFired = true;
359 359
         });
360 360
 
361 361
         $afterQueryFired = false;
362
-        $paginator->setAfterQueryCallback(static function () use (&$afterQueryFired): void {
362
+        $paginator->setAfterQueryCallback(static function() use (&$afterQueryFired): void {
363 363
             $afterQueryFired = true;
364 364
         });
365 365
 
@@ -479,13 +479,13 @@  discard block
 block discarded – undo
479 479
 
480 480
         $this->paginator->setItemsPerPage(10)->setPagesInRange(5);
481 481
 
482
-        $this->paginator->setItemTotalCallback(static function (Pagination $pagination) use ($items): int {
482
+        $this->paginator->setItemTotalCallback(static function(Pagination $pagination) use ($items): int {
483 483
             $pagination->setMeta(['meta_1']);
484 484
 
485 485
             return count($items);
486 486
         });
487 487
 
488
-        $this->paginator->setSliceCallback(static function (int $offset, int $length, Pagination $pagination) use ($items): array {
488
+        $this->paginator->setSliceCallback(static function(int $offset, int $length, Pagination $pagination) use ($items): array {
489 489
             $pagination->setMeta(array_merge($pagination->getMeta(), ['meta_2']));
490 490
 
491 491
             return array_slice($items, $offset, $length);
@@ -558,13 +558,13 @@  discard block
 block discarded – undo
558 558
 
559 559
         $this->paginator->setItemsPerPage(10)->setPagesInRange(5);
560 560
 
561
-        $this->paginator->setItemTotalCallback(static function (Pagination $pagination) use ($items): int {
561
+        $this->paginator->setItemTotalCallback(static function(Pagination $pagination) use ($items): int {
562 562
             $pagination->setMeta(['meta_3']);
563 563
 
564 564
             return count($items);
565 565
         });
566 566
 
567
-        $this->paginator->setSliceCallback(static function (int $offset, int $length, Pagination $pagination) use ($items): array {
567
+        $this->paginator->setSliceCallback(static function(int $offset, int $length, Pagination $pagination) use ($items): array {
568 568
             $pagination->setMeta(array_merge($pagination->getMeta(), ['meta_4']));
569 569
 
570 570
             return array_slice($items, $offset, $length);
@@ -637,13 +637,13 @@  discard block
 block discarded – undo
637 637
 
638 638
         $this->paginator->setItemsPerPage(-1)->setPagesInRange(5);
639 639
 
640
-        $this->paginator->setItemTotalCallback(static function (Pagination $pagination) use ($items): int {
640
+        $this->paginator->setItemTotalCallback(static function(Pagination $pagination) use ($items): int {
641 641
             $pagination->setMeta(['meta_3']);
642 642
 
643 643
             return count($items);
644 644
         });
645 645
 
646
-        $this->paginator->setSliceCallback(static function (int $offset, int $length, Pagination $pagination) use ($items): array {
646
+        $this->paginator->setSliceCallback(static function(int $offset, int $length, Pagination $pagination) use ($items): array {
647 647
             $pagination->setMeta(array_merge($pagination->getMeta(), ['meta_4']));
648 648
 
649 649
             return array_slice($items, $offset, $length);
Please login to merge, or discard this patch.
src/Exception/InvalidPageNumberException.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,4 +46,6 @@
 block discarded – undo
46 46
 /**
47 47
  * Class InvalidPageNumberException
48 48
  */
49
-class InvalidPageNumberException extends InvalidArgumentException {}
49
+class InvalidPageNumberException extends InvalidArgumentException
50
+{
51
+}
Please login to merge, or discard this patch.
src/Exception/CallbackNotFoundException.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,4 +46,6 @@
 block discarded – undo
46 46
 /**
47 47
  * Class CallbackNotFoundException
48 48
  */
49
-class CallbackNotFoundException extends RuntimeException {}
49
+class CallbackNotFoundException extends RuntimeException
50
+{
51
+}
Please login to merge, or discard this patch.
src/Exception/CallbackInvalidException.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,4 +46,6 @@
 block discarded – undo
46 46
 /**
47 47
  * Class CallbackInvalidException
48 48
  */
49
-class CallbackInvalidException extends RuntimeException {}
49
+class CallbackInvalidException extends RuntimeException
50
+{
51
+}
Please login to merge, or discard this patch.
src/Paginator.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
     /**
63 63
      * A callback that is used to determine the total number of items in your collection (returned as an integer).
64 64
      */
65
-    private ?Closure $itemTotalCallback   = null;
65
+    private ?Closure $itemTotalCallback = null;
66 66
 
67 67
     /**
68 68
      * A callback to slice your collection given an offset and length argument.
69 69
      */
70
-    private ?Closure $sliceCallback       = null;
70
+    private ?Closure $sliceCallback = null;
71 71
 
72 72
     /**
73 73
      * A callback to run before the count and slice queries.
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     /**
78 78
      * A callback to run after the count and slice queries.
79 79
      */
80
-    private ?Closure $afterQueryCallback  = null;
80
+    private ?Closure $afterQueryCallback = null;
81 81
 
82 82
     /**
83 83
      * Number of items to include per page.
@@ -146,12 +146,12 @@  discard block
 block discarded – undo
146 146
 
147 147
         $beforeQueryCallback = $this->beforeQueryCallback instanceof Closure
148 148
             ? $this->beforeQueryCallback
149
-            : static function (): void {}
149
+            : static function(): void {}
150 150
         ;
151 151
 
152 152
         $afterQueryCallback = $this->afterQueryCallback instanceof Closure
153 153
             ? $this->afterQueryCallback
154
-            : static function (): void {}
154
+            : static function(): void {}
155 155
         ;
156 156
 
157 157
         $pagination = new Pagination();
Please login to merge, or discard this patch.