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

validate() protected method

protected validate ( )
    protected function validate()
    {
        $keyboard_type = $this->getKeyboardType();
        $keyboard = $this->getProperty($keyboard_type);
        if ($keyboard !== null) {
            if (!is_array($keyboard)) {
                throw new TelegramException($keyboard_type . ' field is not an array!');
            }
            foreach ($keyboard as $item) {
                if (!is_array($item)) {
                    throw new TelegramException($keyboard_type . ' subfield is not an array!');
                }
            }
        }
    }