| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- namespace Opentalent\OtTemplating\Domain\Repository;
- /**
- * Represents an unserialized api response of 'PagedCollection' type
- *
- * @package Opentalent\OtTemplating\Domain\Repository
- */
- class ApiPagedCollection
- {
- private $totalItems;
- private $itemsPerPage;
- private $currentPage;
- private $members;
- /**
- * ApiResponse constructor.
- * @param int $totalItems
- * @param int $itemsPerPage
- * @param int $currentPage
- * @param array $members
- */
- public function __construct(
- int $totalItems,
- int $itemsPerPage,
- int $currentPage,
- array $members
- ) {
- $this->totalItems = $totalItems;
- $this->itemsPerPage = $itemsPerPage;
- $this->currentPage = $currentPage;
- $this->members = $members;
- }
- /**
- * @return int
- */
- public function getTotalItems() {
- return $this->totalItems;
- }
- /**
- * @return int
- */
- public function getItemsPerPage() {
- return $this->itemsPerPage;
- }
- /**
- * @return array
- */
- public function getMembers() {
- return $this->members;
- }
- /**
- * @return int
- */
- public function getCurrentPage() {
- return $this->currentPage;
- }
- /**
- * @return int
- */
- public function getLastPage() {
- $nb = intdiv($this->getTotalItems(), $this->getItemsPerPage());
- if ($this->getTotalItems() % $this->getItemsPerPage() != 0) {
- $nb += 1;
- }
- return $nb;
- }
- }
|