* @method string getText() Label text on the button
21
* @method string getUrl() Optional. HTTP url to be opened when button is pressed
22
* @method string getCallbackData() Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes
23
* @method string getSwitchInlineQuery() Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. Can be empty, in which case just the bot’s username will be inserted.
24
*/
25
class InlineKeyboardButton extends Entity
26
{
27
/**
28
* {@inheritdoc}
29
*/
30
4
protected function validate()
31
{
32
4
$num_params = 0;
33
4
foreach (['url', 'callback_data', 'switch_inline_query'] as $param) {
34
4
if (!empty($this->getProperty($param))) {
35
4
$num_params++;
36
}
37
}
38
4
if ($num_params !== 1) {
39
3
throw new TelegramException('You must use only one of these fields: url, callback_data, switch_inline_query!');