src/Response/PaginateResponse.php line 9

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Slivki\Response;
  4. use JsonSerializable;
  5. final class PaginateResponse implements JsonSerializable
  6. {
  7.     private iterable $items;
  8.     private int $totalCounts;
  9.     public function __construct(iterable $itemsint $totalCounts)
  10.     {
  11.         $this->items $items;
  12.         $this->totalCounts $totalCounts;
  13.     }
  14.     public function getTotalCounts(): int
  15.     {
  16.         return $this->totalCounts;
  17.     }
  18.     public function getItems(): iterable
  19.     {
  20.         return $this->items;
  21.     }
  22.     public function jsonSerialize(): array
  23.     {
  24.         return [
  25.             'items' => $this->items,
  26.             'total' => $this->totalCounts,
  27.         ];
  28.     }
  29. }