‪TYPO3CMS  ‪main
DemandedArrayPaginator.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
21 
27 {
28  private array ‪$items;
29  private int ‪$allCount;
30 
31  private array ‪$paginatedItems = [];
32 
33  public function ‪__construct(
34  array ‪$items,
35  int ‪$currentPageNumber = 1,
36  int ‪$itemsPerPage = 10,
37  int ‪$allCount = 0
38  ) {
39  $this->items = ‪$items;
42  $this->allCount = ‪$allCount;
43 
44  $this->‪updateInternalState();
45  }
46 
47  public function ‪getPaginatedItems(): iterable
48  {
50  }
51 
52  protected function ‪updatePaginatedItems(int ‪$itemsPerPage, int $offset): void
53  {
54  $this->paginatedItems = ‪$this->items;
55  }
56 
57  protected function ‪getTotalAmountOfItems(): int
58  {
59  return ‪$this->allCount;
60  }
61 
62  protected function ‪getAmountOfItemsOnCurrentPage(): int
63  {
64  return count($this->paginatedItems);
65  }
66 }
‪TYPO3\CMS\Reactions\Pagination
Definition: DemandedArrayPaginator.php:18
‪TYPO3\CMS\Reactions\Pagination\DemandedArrayPaginator\updatePaginatedItems
‪updatePaginatedItems(int $itemsPerPage, int $offset)
Definition: DemandedArrayPaginator.php:52
‪TYPO3\CMS\Core\Pagination\AbstractPaginator\setItemsPerPage
‪setItemsPerPage(int $itemsPerPage)
Definition: AbstractPaginator.php:157
‪TYPO3\CMS\Reactions\Pagination\DemandedArrayPaginator
Definition: DemandedArrayPaginator.php:27
‪TYPO3\CMS\Core\Pagination\AbstractPaginator\$itemsPerPage
‪int $itemsPerPage
Definition: AbstractPaginator.php:40
‪TYPO3\CMS\Core\Pagination\AbstractPaginator\updateInternalState
‪updateInternalState()
Definition: AbstractPaginator.php:116
‪TYPO3\CMS\Core\Pagination\AbstractPaginator
Definition: AbstractPaginator.php:21
‪TYPO3\CMS\Reactions\Pagination\DemandedArrayPaginator\__construct
‪__construct(array $items, int $currentPageNumber=1, int $itemsPerPage=10, int $allCount=0)
Definition: DemandedArrayPaginator.php:33
‪TYPO3\CMS\Reactions\Pagination\DemandedArrayPaginator\$paginatedItems
‪array $paginatedItems
Definition: DemandedArrayPaginator.php:31
‪TYPO3\CMS\Reactions\Pagination\DemandedArrayPaginator\getAmountOfItemsOnCurrentPage
‪getAmountOfItemsOnCurrentPage()
Definition: DemandedArrayPaginator.php:62
‪TYPO3\CMS\Reactions\Pagination\DemandedArrayPaginator\getPaginatedItems
‪getPaginatedItems()
Definition: DemandedArrayPaginator.php:47
‪TYPO3\CMS\Reactions\Pagination\DemandedArrayPaginator\$items
‪array $items
Definition: DemandedArrayPaginator.php:28
‪TYPO3\CMS\Core\Pagination\AbstractPaginator\$currentPageNumber
‪int $currentPageNumber
Definition: AbstractPaginator.php:36
‪TYPO3\CMS\Reactions\Pagination\DemandedArrayPaginator\getTotalAmountOfItems
‪getTotalAmountOfItems()
Definition: DemandedArrayPaginator.php:57
‪TYPO3\CMS\Reactions\Pagination\DemandedArrayPaginator\$allCount
‪int $allCount
Definition: DemandedArrayPaginator.php:29
‪TYPO3\CMS\Core\Pagination\AbstractPaginator\setCurrentPageNumber
‪setCurrentPageNumber(int $currentPageNumber)
Definition: AbstractPaginator.php:169