InputTextMessageContent.php 1.06 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
<?php
/**
 * This file is part of the TelegramBot package.
 *
 * (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Longman\TelegramBot\Entities;

use Longman\TelegramBot\Exception\TelegramException;

class InputTextMessageContent extends InputMessageContent
{
    protected $message_text;
    protected $parse_mode;
    protected $disable_web_page_preview;

MBoretto's avatar
MBoretto committed
21 22 23 24 25
    /**
     * InputTextMessageContent constructor.
     *
     * @param array $data
     */
26 27
    public function __construct(array $data)
    {
Jack'lul's avatar
Jack'lul committed
28
        $this->message_text = isset($data['message_text']) ? $data['message_text'] : null;
29 30 31 32
        if (empty($this->message_text)) {
            throw new TelegramException('message_text is empty!');
        }

Jack'lul's avatar
Jack'lul committed
33 34
        $this->parse_mode = isset($data['parse_mode']) ? $data['parse_mode'] : null;
        $this->disable_web_page_preview = isset($data['disable_web_page_preview']) ? $data['disable_web_page_preview'] : null;
35 36
    }
}