1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
Pager.php
См. документацию.
1
<?php
2
3
declare(strict_types=1);
4
5
namespace
Bitrix\Main\Provider\Params;
6
7
use Bitrix\Main\ArgumentException;
8
use Bitrix\Main\UI\PageNavigation;
9
13
class
Pager
implements
PagerInterface
14
{
18
public
function
__construct
(
protected
int
$limit = 50,
protected
int
$offset = 0)
19
{
20
$this
21
->setLimit($this->limit)
22
->setOffset($this->offset)
23
;
24
}
25
29
public
static
function
buildFromPageNavigation
(
PageNavigation
$pageNavigation): static
30
{
31
return
new
static
(limit: $pageNavigation->
getLimit
() ?: 50, offset: $pageNavigation->
getOffset
() ?: 0);
32
}
33
34
public
function
getLimit
(): int
35
{
36
return
$this->limit;
37
}
38
42
public
function
setLimit
(
int
$limit): static
43
{
44
if
($limit < 1)
45
{
46
throw
new
ArgumentException
(
'The limit should be a positive number'
);
47
}
48
49
$this->limit = $limit;
50
51
return
$this;
52
}
53
54
public
function
getOffset
(): int
55
{
56
return
$this->offset;
57
}
58
62
public
function
setOffset
(
int
$offset): static
63
{
64
if
($offset < 0)
65
{
66
throw
new
ArgumentException
(
'The offset should be a not negative number'
);
67
}
68
69
$this->offset = $offset;
70
71
return
$this;
72
}
73
77
public
function
setPage
(
int
$page
): static
78
{
79
if
(
$page
< 1)
80
{
81
throw
new
ArgumentException
(
'The page should be a positive number'
);
82
}
83
84
$this->offset = (
$page
- 1) * $this->limit;
85
86
return
$this;
87
}
88
92
public
function
setSize
(
int
$size):
PagerInterface
93
{
94
return
$this->
setLimit
($size);
95
}
96
}
Bitrix\Main\ArgumentException
Определения
ArgumentException.php:9
Bitrix\Main\Provider\Params\Pager
Определения
Pager.php:14
Bitrix\Main\Provider\Params\Pager\buildFromPageNavigation
static buildFromPageNavigation(PageNavigation $pageNavigation)
Определения
Pager.php:29
Bitrix\Main\Provider\Params\Pager\__construct
__construct(protected int $limit=50, protected int $offset=0)
Определения
Pager.php:18
Bitrix\Main\Provider\Params\Pager\setSize
setSize(int $size)
Определения
Pager.php:92
Bitrix\Main\Provider\Params\Pager\setLimit
setLimit(int $limit)
Определения
Pager.php:42
Bitrix\Main\Provider\Params\Pager\setOffset
setOffset(int $offset)
Определения
Pager.php:62
Bitrix\Main\Provider\Params\Pager\setPage
setPage(int $page)
Определения
Pager.php:77
Bitrix\Main\Provider\Params\Pager\getLimit
getLimit()
Определения
Pager.php:34
Bitrix\Main\Provider\Params\Pager\getOffset
getOffset()
Определения
Pager.php:54
Bitrix\Main\UI\PageNavigation
Определения
pagenavigation.php:27
Bitrix\Main\UI\PageNavigation\getLimit
getLimit()
Определения
pagenavigation.php:252
Bitrix\Main\UI\PageNavigation\getOffset
getOffset()
Определения
pagenavigation.php:239
Bitrix\Main\Provider\Params\PagerInterface
Определения
PagerInterface.php:10
$page
$page
Определения
order_form.php:33
bitrix
modules
main
lib
Provider
Params
Pager.php
Создано системой
1.14.0