Lines 100.00% 3 / 3
Methods 100.00% 2 / 2
Classes 100.00% 1 / 1
Name Lines Methods CRAP
 __construct 100.00% 2 / 2 100.00% 1 / 1 2
 validate 100.00% 1 / 1 100.00% 1 / 1 2
12readonly class PaginatedResult
13{
14    /**
15     * @param T[] $currentPageEntries
16     */
17    public function __construct(
18        public Pagination $pagination,
19        public int $pageCount,
20        public int $totalEntryCount,
21        public array $currentPageEntries,
22    ) {
23        if (!self::validate($pageCount, $totalEntryCount)) {
24            throw new InvalidArgumentException();
25        }
26    }
27
28    private static function validate(int $pageCount, int $totalEntryCount): bool
29    {
30        return ($pageCount >= 0) && ($totalEntryCount >= 0);
31    }
32}