11
11
*/
12
12
class InlineKeyboardPagination implements InlineKeyboardPaginator
13
13
{
14
- private array $ items ;
15
- private int $ itemsPerPage ;
16
- private int $ selectedPage ;
17
- private int $ maxButtons = 5 ;
18
- private bool $ forceButtonCount = false ;
19
- private string $ command ;
20
- private string $ callbackDataFormat = 'command={COMMAND}&oldPage={OLD_PAGE}&newPage={NEW_PAGE} ' ;
21
- private array $ labels = [
14
+ protected array $ items ;
15
+ protected int $ itemsPerPage ;
16
+ protected int $ selectedPage ;
17
+ protected int $ maxButtons = 5 ;
18
+ protected bool $ forceButtonCount = false ;
19
+ protected string $ command ;
20
+ protected string $ callbackDataFormat = 'command={COMMAND}&oldPage={OLD_PAGE}&newPage={NEW_PAGE} ' ;
21
+ protected array $ labels = [
22
22
'default ' => '%d ' ,
23
23
'first ' => '« %d ' ,
24
24
'previous ' => '‹ %d ' ,
@@ -31,10 +31,10 @@ class InlineKeyboardPagination implements InlineKeyboardPaginator
31
31
* @param int $maxButtons
32
32
* @param bool $forceButtonCount
33
33
*
34
- * @return $this
34
+ * @return self
35
35
* @throws InlineKeyboardPaginationException
36
36
*/
37
- public function setMaxButtons (int $ maxButtons = 5 , bool $ forceButtonCount = false ): InlineKeyboardPagination
37
+ public function setMaxButtons (int $ maxButtons = 5 , bool $ forceButtonCount = false ): self
38
38
{
39
39
if ($ maxButtons < 5 || $ maxButtons > 8 ) {
40
40
throw InlineKeyboardPaginationException::invalidMaxButtons ();
@@ -61,9 +61,9 @@ public function getCallbackDataFormat(): string
61
61
*
62
62
* @param string $callbackDataFormat
63
63
*
64
- * @return InlineKeyboardPagination
64
+ * @return self
65
65
*/
66
- public function setCallbackDataFormat (string $ callbackDataFormat ): InlineKeyboardPagination
66
+ public function setCallbackDataFormat (string $ callbackDataFormat ): self
67
67
{
68
68
$ this ->callbackDataFormat = $ callbackDataFormat ;
69
69
@@ -85,9 +85,9 @@ public function getLabels(): array
85
85
*
86
86
* @param array $labels
87
87
*
88
- * @return InlineKeyboardPagination
88
+ * @return self
89
89
*/
90
- public function setLabels (array $ labels ): InlineKeyboardPagination
90
+ public function setLabels (array $ labels ): self
91
91
{
92
92
$ this ->labels = $ labels ;
93
93
@@ -97,7 +97,7 @@ public function setLabels(array $labels): InlineKeyboardPagination
97
97
/**
98
98
* @inheritdoc
99
99
*/
100
- public function setCommand (string $ command = 'pagination ' ): InlineKeyboardPagination
100
+ public function setCommand (string $ command = 'pagination ' ): self
101
101
{
102
102
$ this ->command = $ command ;
103
103
@@ -108,7 +108,7 @@ public function setCommand(string $command = 'pagination'): InlineKeyboardPagina
108
108
* @inheritdoc
109
109
* @throws InlineKeyboardPaginationException
110
110
*/
111
- public function setSelectedPage (int $ selectedPage ): InlineKeyboardPagination
111
+ public function setSelectedPage (int $ selectedPage ): self
112
112
{
113
113
$ numberOfPages = $ this ->getNumberOfPages ();
114
114
if ($ selectedPage < 1 || $ selectedPage > $ numberOfPages ) {
@@ -135,10 +135,10 @@ public function getItemsPerPage(): int
135
135
*
136
136
* @param int $itemsPerPage
137
137
*
138
- * @return InlineKeyboardPagination
138
+ * @return self
139
139
* @throws InlineKeyboardPaginationException
140
140
*/
141
- public function setItemsPerPage (int $ itemsPerPage ): InlineKeyboardPagination
141
+ public function setItemsPerPage (int $ itemsPerPage ): self
142
142
{
143
143
if ($ itemsPerPage <= 0 ) {
144
144
throw InlineKeyboardPaginationException::invalidItemsPerPage ();
@@ -154,10 +154,10 @@ public function setItemsPerPage(int $itemsPerPage): InlineKeyboardPagination
154
154
*
155
155
* @param array $items
156
156
*
157
- * @return InlineKeyboardPagination
157
+ * @return self
158
158
* @throws InlineKeyboardPaginationException
159
159
*/
160
- public function setItems (array $ items ): InlineKeyboardPagination
160
+ public function setItems (array $ items ): self
161
161
{
162
162
if (empty ($ items )) {
163
163
throw InlineKeyboardPaginationException::noItems ();
0 commit comments