Longman\TelegramBot\Entities\InlineKeyboardButton::validate PHP Method

validate() protected method

protected validate ( )
    protected function validate()
    {
        if ($this->getProperty('text', '') === '') {
            throw new TelegramException('You must add some text to the button!');
        }
        $num_params = 0;
        foreach (['url', 'callback_data', 'switch_inline_query'] as $param) {
            if (!empty($this->getProperty($param))) {
                $num_params++;
            }
        }
        if ($num_params !== 1) {
            throw new TelegramException('You must use only one of these fields: url, callback_data, switch_inline_query!');
        }
    }
InlineKeyboardButton