InlineQueryResultArticle.php 1.95 KB
Newer Older
MBoretto's avatar
MBoretto committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
<?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;

MBoretto's avatar
MBoretto committed
15
class InlineQueryResultArticle extends InlineQueryResult
MBoretto's avatar
MBoretto committed
16 17 18 19 20 21 22 23 24 25 26
{
    protected $message_text;
    protected $url;
    protected $hide_url;
    protected $description;
    protected $thumb_url;
    protected $thumb_width;
    protected $thumb_height;

    public function __construct(array $data)
    {
MBoretto's avatar
MBoretto committed
27
        parent::__construct($data);
MBoretto's avatar
MBoretto committed
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79

        $this->type = 'article';

        $this->message_text = isset($data['message_text']) ? $data['message_text'] : null;
        if (empty($this->message_text)) {
            throw new TelegramException('message_text is empty!');
        }

        $this->url = isset($data['url']) ? $data['url'] : null;
        $this->hide_url = isset($data['hide_url']) ? $data['hide_url'] : null;
        $this->description = isset($data['description']) ? $data['description'] : null;
        $this->thumb_url = isset($data['thumb_url']) ? $data['thumb_url'] : null;
        $this->thumb_width = isset($data['thumb_width']) ? $data['thumb_width'] : null;
        $this->thumb_height = isset($data['thumb_height']) ? $data['thumb_height'] : null;

    }

    public function getMessageText()
    {
        return $this->message_text;
    }

    public function getUrl()
    {
        return $this->url;
    }

    public function getHideUrl()
    {
        return $this->hide_url;
    }

    public function getDescription()
    {
        return $this->description;
    }

    public function getThumbUrl()
    {
        return $this->thumb_url;
    }

    public function getThumbWidth()
    {
        return $this->thumb_width;
    }

    public function getThumbHeight()
    {
        return $this->thumb_height;
    }
}