*/ private array $pages; private int $totalItems; private int $currentPage; private int $itemsPerPage; /** * @param array $pages */ public function __construct(array $pages, int $totalItems, int $currentPage, int $itemsPerPage) { $this->pages = array_map( static fn (Page $page) => new PageResponse($page), $pages ); $this->totalItems = $totalItems; $this->currentPage = $currentPage; $this->itemsPerPage = $itemsPerPage; } /** * @return array */ public function getPages(): array { return $this->pages; } public function getTotalItems(): int { return $this->totalItems; } public function getCurrentPage(): int { return $this->currentPage; } public function getItemsPerPage(): int { return $this->itemsPerPage; } public function getTotalPages(): int { return (int) ceil($this->totalItems / $this->itemsPerPage); } }