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