Passed
Push — master ( c05883...1d5c29 )
by Nikolay
02:30
created

InlineQueryResultMpeg4GifType   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 94
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 19
dl 0
loc 94
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 16 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Type\InlineQueryResult;
6
7
use TgBotApi\BotApiBase\Method\Interfaces\HasParseModeVariableInterface;
8
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait;
9
use TgBotApi\BotApiBase\Type\InputMessageContent\InputMessageContentType;
10
11
/**
12
 * Class InlineQueryResultMpeg4GifType.
13
 *
14
 * @see https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif
15
 */
16
class InlineQueryResultMpeg4GifType extends InlineQueryResultType implements HasParseModeVariableInterface
17
{
18
    use FillFromArrayTrait;
19
20
    /**
21
     * A valid URL for the MP4 file. File size must not exceed 1MB.
22
     *
23
     * @var string
24
     */
25
    public $mpeg4Url;
26
27
    /**
28
     * Optional. Video width.
29
     *
30
     * @var int|null
31
     */
32
    public $mpeg4Width;
33
34
    /**
35
     * Optional. Video height.
36
     *
37
     * @var int|null
38
     */
39
    public $mpeg4Height;
40
41
    /**
42
     * Optional. Video duration.
43
     *
44
     * @var int|null
45
     */
46
    public $mpeg4Duration;
47
48
    /**
49
     * URL of the static thumbnail (jpeg or gif) for the result.
50
     *
51
     * @var string
52
     */
53
    public $thumbUrl;
54
55
    /**
56
     * Optional. Title for the result.
57
     *
58
     * @var string|null
59
     */
60
    public $title;
61
62
    /**
63
     * Optional. Caption of the GIF file to be sent, 0-1024 characters.
64
     *
65
     * @var string|null
66
     */
67
    public $caption;
68
69
    /**
70
     * Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic,
71
     * fixed-width text or inline URLs in the media caption.
72
     *
73
     * @var string|null
74
     */
75
    public $parseMode;
76
77
    /**
78
     * Optional. Content of the message to be sent instead of the GIF animation.
79
     *
80
     * @var InputMessageContentType|null
81
     */
82
    public $inputMessageContent;
83
84
    /**
85
     * @param string     $id
86
     * @param string     $mpeg4Url
87
     * @param string     $thumbUrl
88
     * @param array|null $data
89
     *
90
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
91
     *
92
     * @return InlineQueryResultMpeg4GifType
93
     */
94
    public static function create(
95
        string $id,
96
        string $mpeg4Url,
97
        string $thumbUrl,
98
        array $data = null
99
    ): InlineQueryResultMpeg4GifType {
100
        $instance = new static();
101
        $instance->type = static::TYPE_MPEG4GIF;
102
        $instance->id = $id;
103
        $instance->mpeg4Url = $mpeg4Url;
104
        $instance->thumbUrl = $thumbUrl;
105
        if ($data) {
106
            $instance->fill($data);
107
        }
108
109
        return $instance;
110
    }
111
}
112