28 lines
554 B
PHP
28 lines
554 B
PHP
<?php
|
|
|
|
namespace App\Domain\Manga\Application\Response;
|
|
|
|
readonly class ChapterListResponse
|
|
{
|
|
public function __construct(
|
|
public array $chapters,
|
|
public int $total,
|
|
public int $page,
|
|
public int $limit
|
|
) {}
|
|
|
|
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;
|
|
}
|
|
}
|