Files
Mangarr/src/Domain/Reader/Application/Response/ChapterPagesResponse.php
ext.jeremy.guillot@maxicoffee.domains 7506a7a3c1 style: apply php-cs-fixer formatting (PSR-12)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 20:46:59 +01:00

59 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Domain\Reader\Application\Response;
use App\Domain\Reader\Domain\Model\Page;
final class ChapterPagesResponse
{
/** @var array<PageResponse> */
private array $pages;
private int $totalItems;
private int $currentPage;
private int $itemsPerPage;
/**
* @param array<Page> $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<PageResponse>
*/
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);
}
}