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

InlineQueryResultCachedVideoType   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 16
dl 0
loc 75
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 InlineQueryResultCachedVideoType.
13
 *
14
 * @see https://core.telegram.org/bots/api#inlinequeryresultcachedvideo
15
 */
16
class InlineQueryResultCachedVideoType extends InlineQueryResultType implements HasParseModeVariableInterface
17
{
18
    use FillFromArrayTrait;
19
20
    /**
21
     * A valid file identifier for the video file.
22
     *
23
     * @var string
24
     */
25
    public $videoFileId;
26
27
    /**
28
     * Title for the result.
29
     *
30
     * @var string
31
     */
32
    public $title;
33
34
    /**
35
     * Optional. Caption of the video to be sent, 0-1024 characters.
36
     *
37
     * @var string|null
38
     */
39
    public $caption;
40
41
    /**
42
     * Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic,
43
     * fixed-width text or inline URLs in the media caption.
44
     *
45
     * @var string|null
46
     */
47
    public $parseMode;
48
49
    /**
50
     * Optional. Short description of the result.
51
     *
52
     * @var string|null
53
     */
54
    public $description;
55
56
    /**
57
     * Optional. Content of the message to be sent instead of the video.
58
     * This field is required if InlineQueryResultVideo is used to send an HTML-page as a result
59
     * (e.g., a YouTube video).
60
     *
61
     * @var InputMessageContentType|null
62
     */
63
    public $inputMessageContent;
64
65
    /**
66
     * @param string     $id
67
     * @param string     $videoFileId
68
     * @param string     $title
69
     * @param array|null $data
70
     *
71
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
72
     *
73
     * @return InlineQueryResultCachedVideoType
74
     */
75
    public static function create(
76
        string $id,
77
        string $videoFileId,
78
        string $title,
79
        array $data = null
80
    ): InlineQueryResultCachedVideoType {
81
        $instance = new static();
82
        $instance->type = static::TYPE_VIDEO;
83
        $instance->id = $id;
84
        $instance->videoFileId = $videoFileId;
85
        $instance->title = $title;
86
        if ($data) {
87
            $instance->fill($data);
88
        }
89
90
        return $instance;
91
    }
92
}
93