InlineQueryResultCachedVideoType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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