Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 148 Revision 399
Zeile 32... Zeile 32...
32
 */
32
 */
33
class Paginator
33
class Paginator
34
{
34
{
35
	use Nette\SmartObject;
35
	use Nette\SmartObject;
Zeile 36... Zeile -...
36
 
-
 
37
	/** @var int */
36
 
38
	private $base = 1;
-
 
39
 
-
 
40
	/** @var int */
37
	private int $base = 1;
41
	private $itemsPerPage = 1;
-
 
42
 
-
 
43
	/** @var int */
38
	private int $itemsPerPage = 1;
44
	private $page = 1;
-
 
45
 
-
 
46
	/** @var int|null */
39
	private int $page = 1;
Zeile 47... Zeile 40...
47
	private $itemCount;
40
	private ?int $itemCount = null;
48
 
41
 
49
 
-
 
50
	/**
42
 
51
	 * Sets current page number.
43
	/**
52
	 * @return static
44
	 * Sets current page number.
53
	 */
45
	 */
54
	public function setPage(int $page)
46
	public function setPage(int $page): static
55
	{
47
	{
Zeile 107... Zeile 99...
107
	}
99
	}
Zeile 108... Zeile 100...
108
 
100
 
109
 
101
 
110
	/**
-
 
111
	 * Sets first page (base) number.
102
	/**
112
	 * @return static
103
	 * Sets first page (base) number.
113
	 */
104
	 */
114
	public function setBase(int $base)
105
	public function setBase(int $base): static
115
	{
106
	{
116
		$this->base = $base;
107
		$this->base = $base;
Zeile 170... Zeile 161...
170
	}
161
	}
Zeile 171... Zeile 162...
171
 
162
 
172
 
163
 
173
	/**
-
 
174
	 * Sets the number of items to display on a single page.
164
	/**
175
	 * @return static
165
	 * Sets the number of items to display on a single page.
176
	 */
166
	 */
177
	public function setItemsPerPage(int $itemsPerPage)
167
	public function setItemsPerPage(int $itemsPerPage): static
178
	{
168
	{
179
		$this->itemsPerPage = max(1, $itemsPerPage);
169
		$this->itemsPerPage = max(1, $itemsPerPage);
Zeile 190... Zeile 180...
190
	}
180
	}
Zeile 191... Zeile 181...
191
 
181
 
192
 
182
 
193
	/**
-
 
194
	 * Sets the total number of items.
183
	/**
195
	 * @return static
184
	 * Sets the total number of items.
196
	 */
185
	 */
197
	public function setItemCount(?int $itemCount = null)
186
	public function setItemCount(?int $itemCount = null): static
198
	{
187
	{
199
		$this->itemCount = $itemCount === null ? null : max(0, $itemCount);
188
		$this->itemCount = $itemCount === null ? null : max(0, $itemCount);