1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace TelegramBot\Api\Types; |
4
|
|
|
|
5
|
|
|
use TelegramBot\Api\BaseType; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class ReplyKeyboardMarkup |
9
|
|
|
* This object represents a custom keyboard with reply options (see Introduction to bots for details and examples). |
10
|
|
|
* |
11
|
|
|
* @package TelegramBot\Api\Types |
12
|
|
|
*/ |
13
|
|
|
class ReplyKeyboardMarkup extends BaseType |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* {@inheritdoc} |
17
|
|
|
* |
18
|
|
|
* @var array |
19
|
|
|
*/ |
20
|
|
|
protected static $requiredParams = ['keyboard']; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* {@inheritdoc} |
24
|
|
|
* |
25
|
|
|
* @var array |
26
|
|
|
*/ |
27
|
|
|
protected static $map = [ |
28
|
|
|
'keyboard' => true, |
29
|
|
|
'one_time_keyboard' => true, |
30
|
|
|
'resize_keyboard' => true, |
31
|
|
|
'selective' => true, |
32
|
|
|
'is_persistent' => true |
33
|
|
|
]; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Array of button rows, each represented by an Array of Strings |
37
|
|
|
* Array of Array of String |
38
|
|
|
* |
39
|
|
|
* @var array |
40
|
|
|
*/ |
41
|
|
|
protected $keyboard; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Optional. Requests clients to resize the keyboard vertically for optimal fit |
45
|
|
|
* (e.g., make the keyboard smaller if there are just two rows of buttons). |
46
|
|
|
* Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard. |
47
|
|
|
* |
48
|
|
|
* @var bool|null |
49
|
|
|
*/ |
50
|
|
|
protected $resizeKeyboard; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Optional. Requests clients to hide the keyboard as soon as it's been used. Defaults to false. |
54
|
|
|
* |
55
|
|
|
* @var bool|null |
56
|
|
|
*/ |
57
|
|
|
protected $oneTimeKeyboard; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Optional. Use this parameter if you want to show the keyboard to specific users only. |
61
|
|
|
* Targets: |
62
|
|
|
* 1) users that are @mentioned in the text of the Message object; |
63
|
|
|
* 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message. |
64
|
|
|
* |
65
|
|
|
* @var bool|null |
66
|
|
|
*/ |
67
|
|
|
protected $selective; |
68
|
16 |
|
|
69
|
|
|
/** |
70
|
16 |
|
* Optional. Requests clients to always show the keyboard when the regular keyboard is hidden. |
71
|
16 |
|
* Defaults to false, in which case the custom keyboard can be hidden and opened with a keyboard icon. |
72
|
16 |
|
* |
73
|
16 |
|
* @var bool|null |
74
|
16 |
|
*/ |
75
|
|
|
protected $isPersistent; |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @param array $keyboard |
79
|
1 |
|
* @param bool|null $oneTimeKeyboard |
80
|
|
|
* @param bool|null $resizeKeyboard |
81
|
1 |
|
* @param bool|null $selective |
82
|
|
|
* @param bool|null $isPersistent |
83
|
|
|
*/ |
84
|
|
|
public function __construct($keyboard = [], $oneTimeKeyboard = null, $resizeKeyboard = null, $selective = null, $isPersistent = null) |
85
|
|
|
{ |
86
|
|
|
$this->keyboard = $keyboard; |
87
|
2 |
|
$this->oneTimeKeyboard = $oneTimeKeyboard; |
88
|
|
|
$this->resizeKeyboard = $resizeKeyboard; |
89
|
2 |
|
$this->selective = $selective; |
90
|
2 |
|
$this->isPersistent = $isPersistent; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @return array |
95
|
1 |
|
*/ |
96
|
|
|
public function getKeyboard() |
97
|
1 |
|
{ |
98
|
|
|
return $this->keyboard; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* @param array $keyboard |
103
|
2 |
|
* @return void |
104
|
|
|
*/ |
105
|
2 |
|
public function setKeyboard($keyboard) |
106
|
2 |
|
{ |
107
|
|
|
$this->keyboard = $keyboard; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
1 |
|
* @return bool|null |
112
|
|
|
*/ |
113
|
1 |
|
public function isOneTimeKeyboard() |
114
|
|
|
{ |
115
|
|
|
return $this->oneTimeKeyboard; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
2 |
|
* @param bool $oneTimeKeyboard |
120
|
|
|
* @return void |
121
|
2 |
|
*/ |
122
|
2 |
|
public function setOneTimeKeyboard($oneTimeKeyboard) |
123
|
|
|
{ |
124
|
|
|
$this->oneTimeKeyboard = $oneTimeKeyboard; |
125
|
|
|
} |
126
|
|
|
|
127
|
1 |
|
/** |
128
|
|
|
* @return bool|null |
129
|
1 |
|
*/ |
130
|
|
|
public function isResizeKeyboard() |
131
|
|
|
{ |
132
|
|
|
return $this->resizeKeyboard; |
133
|
|
|
} |
134
|
|
|
|
135
|
2 |
|
/** |
136
|
|
|
* @param bool $resizeKeyboard |
137
|
2 |
|
* @return void |
138
|
2 |
|
*/ |
139
|
|
|
public function setResizeKeyboard($resizeKeyboard) |
140
|
|
|
{ |
141
|
|
|
$this->resizeKeyboard = $resizeKeyboard; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* @return bool|null |
146
|
|
|
*/ |
147
|
|
|
public function isSelective() |
148
|
|
|
{ |
149
|
|
|
return $this->selective; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* @param bool $selective |
154
|
|
|
* @return void |
155
|
|
|
*/ |
156
|
|
|
public function setSelective($selective) |
157
|
|
|
{ |
158
|
|
|
$this->selective = $selective; |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* @return bool|null |
163
|
|
|
*/ |
164
|
|
|
public function getIsPersistent() |
165
|
|
|
{ |
166
|
|
|
return $this->isPersistent; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* @param bool $isPersistent |
171
|
|
|
* @return void |
172
|
|
|
*/ |
173
|
|
|
public function setIsPersistent($isPersistent) |
174
|
|
|
{ |
175
|
|
|
$this->isPersistent = $isPersistent; |
176
|
|
|
} |
177
|
|
|
} |
178
|
|
|
|