1 | <?php |
||
28 | class Pagination { |
||
29 | /** |
||
30 | * @var int |
||
31 | */ |
||
32 | protected $resultsPerPage; |
||
33 | |||
34 | /** |
||
35 | * @var int |
||
36 | */ |
||
37 | protected $page; |
||
38 | |||
39 | /** |
||
40 | * Pagination constructor. |
||
41 | * |
||
42 | * @param int $page |
||
43 | * @param int $resultsPerPage |
||
44 | */ |
||
45 | public function __construct(int $page = 0, int $resultsPerPage = 01) |
||
50 | |||
51 | /** |
||
52 | * Gets the currently showing page's number |
||
53 | * |
||
54 | * @return int page number currently showing |
||
55 | */ |
||
56 | public function getPage() |
||
60 | |||
61 | /** |
||
62 | * Sets the page that should be shown |
||
63 | * |
||
64 | * @param int $page page number to show |
||
65 | * @return void |
||
66 | */ |
||
67 | public function setPage($page) |
||
71 | |||
72 | /** |
||
73 | * Gets the index of the first result document we're showing |
||
74 | * |
||
75 | * @return int index of the currently first document showing |
||
76 | */ |
||
77 | public function getStartIndex() |
||
81 | |||
82 | /** |
||
83 | * Gets the index of the last result document we're showing |
||
84 | * |
||
85 | * @return int index of the currently last document showing |
||
86 | */ |
||
87 | public function getEndIndex() |
||
91 | |||
92 | /** |
||
93 | * Returns the number of results that should be shown per page |
||
94 | * |
||
95 | * @return int number of results to show per page |
||
96 | */ |
||
97 | public function getResultsPerPage() |
||
101 | |||
102 | /** |
||
103 | * Sets the number of results that should be shown per page |
||
104 | * |
||
105 | * @param int $resultsPerPage Number of results to show per page |
||
106 | * @return void |
||
107 | */ |
||
108 | public function setResultsPerPage($resultsPerPage) |
||
112 | } |