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
9readonly class Pagination
10{
11    public function __construct(
12        public int $pageNumber,
13        public int $pageSize,
14    ) {
15        if (!self::validate($pageNumber, $pageSize)) {
16            throw new InvalidArgumentException();
17        }
18    }
19
20    private static function validate(int $pageNumber, int $pageSize): bool
21    {
22        return ($pageNumber > 0) && ($pageSize > 0);
23    }
24}