perPage = $perPage; $this->currentPage = $currentPage; } public function isValid(): bool { return $this->perPage !== null && $this->currentPage !== null; } public static function fromBody(array $body): Pagination { return new Pagination( $body['perPage'] ?? null, $body['currentPage'] ?? null, ); } }