‪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 
29 {
30  private array ‪$items;
31  private int ‪$allCount;
32 
33  private array ‪$paginatedItems = [];
34 
35  public function ‪__construct(
36  array ‪$items,
37  int ‪$currentPageNumber = 1,
38  int ‪$itemsPerPage = 10,
39  int ‪$allCount = 0
40  ) {
41  $this->items = ‪$items;
44  $this->allCount = ‪$allCount;
45 
46  $this->‪updateInternalState();
47  }
48 
49  public function ‪getPaginatedItems(): iterable
50  {
52  }
53 
54  protected function ‪updatePaginatedItems(int ‪$itemsPerPage, int $offset): void
55  {
56  $this->paginatedItems = ‪$this->items;
57  }
58 
59  protected function ‪getTotalAmountOfItems(): int
60  {
61  return ‪$this->allCount;
62  }
63 
64  protected function ‪getAmountOfItemsOnCurrentPage(): int
65  {
66  return count($this->paginatedItems);
67  }
68 }
‪TYPO3\CMS\Core\Pagination\AbstractPaginator\setItemsPerPage
‪setItemsPerPage(int $itemsPerPage)
Definition: AbstractPaginator.php:157
‪TYPO3\CMS\Webhooks\Pagination\DemandedArrayPaginator\$allCount
‪int $allCount
Definition: DemandedArrayPaginator.php:31
‪TYPO3\CMS\Webhooks\Pagination\DemandedArrayPaginator\$items
‪array $items
Definition: DemandedArrayPaginator.php:30
‪TYPO3\CMS\Core\Pagination\AbstractPaginator\$itemsPerPage
‪int $itemsPerPage
Definition: AbstractPaginator.php:40
‪TYPO3\CMS\Webhooks\Pagination
Definition: DemandedArrayPaginator.php:18
‪TYPO3\CMS\Core\Pagination\AbstractPaginator\updateInternalState
‪updateInternalState()
Definition: AbstractPaginator.php:116
‪TYPO3\CMS\Core\Pagination\AbstractPaginator
Definition: AbstractPaginator.php:21
‪TYPO3\CMS\Webhooks\Pagination\DemandedArrayPaginator\__construct
‪__construct(array $items, int $currentPageNumber=1, int $itemsPerPage=10, int $allCount=0)
Definition: DemandedArrayPaginator.php:35
‪TYPO3\CMS\Webhooks\Pagination\DemandedArrayPaginator
Definition: DemandedArrayPaginator.php:29
‪TYPO3\CMS\Webhooks\Pagination\DemandedArrayPaginator\updatePaginatedItems
‪updatePaginatedItems(int $itemsPerPage, int $offset)
Definition: DemandedArrayPaginator.php:54
‪TYPO3\CMS\Webhooks\Pagination\DemandedArrayPaginator\$paginatedItems
‪array $paginatedItems
Definition: DemandedArrayPaginator.php:33
‪TYPO3\CMS\Webhooks\Pagination\DemandedArrayPaginator\getTotalAmountOfItems
‪getTotalAmountOfItems()
Definition: DemandedArrayPaginator.php:59
‪TYPO3\CMS\Webhooks\Pagination\DemandedArrayPaginator\getPaginatedItems
‪getPaginatedItems()
Definition: DemandedArrayPaginator.php:49
‪TYPO3\CMS\Webhooks\Pagination\DemandedArrayPaginator\getAmountOfItemsOnCurrentPage
‪getAmountOfItemsOnCurrentPage()
Definition: DemandedArrayPaginator.php:64
‪TYPO3\CMS\Core\Pagination\AbstractPaginator\$currentPageNumber
‪int $currentPageNumber
Definition: AbstractPaginator.php:36
‪TYPO3\CMS\Core\Pagination\AbstractPaginator\setCurrentPageNumber
‪setCurrentPageNumber(int $currentPageNumber)
Definition: AbstractPaginator.php:169