InlineQueryResultMpeg4GifType::create()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

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