value <= 0) { throw new \InvalidArgumentException('Page size must be greater than 0'); } if ($this->value > self::MAX_PAGE_SIZE) { throw new \InvalidArgumentException('Page size must be less than or equal to ' . self::MAX_PAGE_SIZE); } } public static function of(int $value): self { return new self($value); } public static function default(): self { return new self(self::DEFAULT_SIZE); } public function value(): int { return $this->value; } public function equals(mixed $other): bool { return $other instanceof self && $this->value === $other->value; } public function __toString(): string { return (string) $this->value; } public function jsonSerialize(): int { return $this->value; } }