count; } public function page(): int { return $this->page; } public function limit(): int { return $this->limit; } public function offset(): int { return (int) ( abs( ( $this->page() - 1 ) * $this->limit() ) ); } public function pagination(int $page, int $itemCount) : void { $this->count = $itemCount; $this->page = $page; } public function pageCount() : int { return $this->limit() ? $this->pageCount = ceil($this->count() / $this->limit()) : 1; } public function hasPagination() : int { return $this->pageCount() > 1; } public function skipCount(bool $value) : self { $this->skipCount = $value; return $this; } public function resultShown() : int { $total = $this->page() * $this->limit(); return $total <= $this->count() ? $total : $this->count(); } public function jsonSerialize(): mixed { $this->pageCount(); return $this; } }