* @method string getText() Label text on the button
* @method string getUrl() Optional. HTTP url to be opened when button is pressed
* @method string getCallbackData() Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes
* @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.
*
* @method $this setText(string $text) Label text on the button
* @method $this setUrl(string $url) Optional. HTTP url to be opened when button is pressed
* @method $this setCallbackData(string $callback_data) Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes
* @method $this setSwitchInlineQuery(string $switch_inline_query) 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.
*/
classInlineKeyboardButtonextendsKeyboardButton
{
/**
* Check if the passed data array could be an InlineKeyboardButton.
*
* @param array $data
*
* @return bool
*/
publicstaticfunctioncouldBe($data)
{
returnis_array($data)&&
array_key_exists('text',$data)&&(
array_key_exists('url',$data)||
array_key_exists('callback_data',$data)||
array_key_exists('switch_inline_query',$data)
);
}
/**
* {@inheritdoc}
*/
protectedfunctionvalidate()
{
if($this->getProperty('text','')===''){
thrownewTelegramException('You must add some text to the button!');