InlineQueryResultMpeg4Gif.php 1.89 KB
Newer Older
MBoretto's avatar
MBoretto committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 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
<?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 InlineQueryResultMpeg4Gif extends InlineQueryResult
{

    protected $mpeg4_url;
    protected $mpeg4_width;
    protected $mpeg4_height;
    protected $thumb_url;
    protected $caption;
    protected $message_text;

    public function __construct(array $data)
    {
        parent::__construct($data);

        $this->type = 'mpeg4_gif';

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

        $this->mpeg4_width = isset($data['mpeg4_width']) ? $data['mpeg4_width'] : null;
        $this->mpeg4_height = isset($data['mpeg4_height']) ? $data['mpeg4_height'] : null;

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

        $this->caption = isset($data['caption']) ? $data['caption'] : null;
        $this->message_text = isset($data['message_text']) ? $data['message_text'] : null;

    }

    public function getMpeg4Url()
    {
        return $this->mpeg4_url;
    }
    public function getMpeg4Width()
    {
        return $this->mpeg4_width;
    }
    public function getMpeg4Height()
    {
        return $this->mpeg4_height;
    }
    public function getThumbUrl()
    {
        return $this->thumb_url;
    }
    public function getCaption()
    {
        return $this->caption;
    }
    public function getMessageText()
    {
        return $this->message_text;
    }
}