31 lines
597 B
PHP
31 lines
597 B
PHP
<?php
|
|
|
|
namespace App\Domain\Manga\Application\Response;
|
|
|
|
readonly class MangaListResponse
|
|
{
|
|
public function __construct(
|
|
public array $mangas,
|
|
public int $total,
|
|
public int $page,
|
|
public int $limit,
|
|
public array $chapterCounts = []
|
|
) {
|
|
}
|
|
|
|
public function getTotalPages(): int
|
|
{
|
|
return (int) ceil($this->total / $this->limit);
|
|
}
|
|
|
|
public function hasNextPage(): bool
|
|
{
|
|
return $this->page < $this->getTotalPages();
|
|
}
|
|
|
|
public function hasPreviousPage(): bool
|
|
{
|
|
return $this->page > 1;
|
|
}
|
|
}
|