InputMediaVideoType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 13
dl 0
loc 61
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 10 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Type\InputMedia;
6
7
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait;
8
use TgBotApi\BotApiBase\Type\InputFileType;
9
10
/**
11
 * Class InputMediaVideoType.
12
 *
13
 * @see https://core.telegram.org/bots/api#inputmediavideo
14
 */
15
class InputMediaVideoType extends InputMediaType
16
{
17
    use FillFromArrayTrait;
18
    /**
19
     * Optional. Thumbnail of the file sent. The thumbnail should be in JPEG format and less than 200 kB in size.
20
     * A thumbnail‘s width and height should not exceed 90.
21
     * Ignored if the file is not uploaded using multipart/form-data.
22
     * Thumbnails can’t be reused and can be only uploaded as a new file,
23
     * so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data
24
     * under <file_attach_name>.
25
     *
26
     * @var InputFileType|string|null
27
     */
28
    public $thumb;
29
30
    /**
31
     * Optional. Video width.
32
     *
33
     * @var int|null
34
     */
35
    public $width;
36
37
    /**
38
     * Optional. Video height.
39
     *
40
     * @var int|null
41
     */
42
    public $height;
43
44
    /**
45
     * Optional. Video duration.
46
     *
47
     * @var int|null
48
     */
49
    public $duration;
50
51
    /**
52
     * Optional. Pass True, if the uploaded video is suitable for streaming.
53
     *
54
     * @var bool|null
55
     */
56
    public $supportStreaming;
57
58
    /**
59
     * @param string|InputFileType $media
60
     * @param array|null           $data
61
     *
62
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
63
     *
64
     * @return InputMediaVideoType
65
     */
66 1
    public static function create($media, array $data = null): InputMediaVideoType
67
    {
68 1
        $instance = new static();
69 1
        $instance->media = $media;
70 1
        $instance->type = static::TYPE_VIDEO;
71 1
        if ($data) {
72 1
            $instance->fill($data);
73
        }
74
75 1
        return $instance;
76
    }
77
}
78