Completed
Push — master ( 0a6e40...a44d55 )
by Camilo
06:48
created

SendVideo::getLocalFiles()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace unreal4u\TelegramAPI\Telegram\Methods;
6
7
use Generator;
8
use unreal4u\TelegramAPI\Abstracts\KeyboardMethods;
9
use unreal4u\TelegramAPI\Abstracts\TelegramMethods;
10
use unreal4u\TelegramAPI\Telegram\Types\Custom\InputFile;
11
12
/**
13
 * Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). On
14
 * success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be
15
 * changed in the future.
16
 *
17
 * Objects defined as-is February 2018
18
 *
19
 * @see https://core.telegram.org/bots/api#sendvideo
20
 */
21
class SendVideo extends TelegramMethods
22
{
23
    /**
24
     * Unique identifier for the target chat or username of the target channel (in the format @channelusername)
25
     * @var string
26
     */
27
    public $chat_id = '';
28
29
    /**
30
     * Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass
31
     * an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using the InputFile
32
     * class
33
     * @see InputFile
34
     * @var string|InputFile
35
     */
36
    public $video = '';
37
38
    /**
39
     * Optional. Duration of sent video in seconds
40
     * @var int
41
     */
42
    public $duration = 0;
43
44
    /**
45
     * Video width
46
     * @var int
47
     */
48
    public $width = 0;
49
50
    /**
51
     * Video height
52
     * @var int
53
     */
54
    public $height = 0;
55
56
    /**
57
     *
58
     * @var InputFile
59
     */
60
    public $thumb;
61
62
    /**
63
     * Video caption (may also be used when resending videos by file_id).
64
     * @var string
65
     */
66
    public $caption = '';
67
68
    /**
69
     * Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs
70
     * in the media caption
71
     * @var string
72
     */
73
    public $parse_mode = '';
74
75
    /**
76
     * Pass True, if the uploaded video is suitable for streaming
77
     * @var bool
78
     */
79
    public $supports_streaming = false;
80
81
    /**
82
     * Optional. Sends the message silently. iOS users will not receive a notification, Android users will receive a
83
     * notification with no sound.
84
     * @see https://telegram.org/blog/channels-2-0#silent-messages
85
     * @var bool
86
     */
87
    public $disable_notification = false;
88
89
    /**
90
     * Optional. If the message is a reply, ID of the original message
91
     * @var int
92
     */
93
    public $reply_to_message_id = 0;
94
95
    /**
96
     * Optional. Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to
97
     * hide keyboard or to force a reply from the user
98
     * @var KeyboardMethods
99
     */
100
    public $reply_markup;
101
102 1
    public function getMandatoryFields(): array
103
    {
104
        return [
105 1
            'chat_id',
106
            'video',
107
        ];
108
    }
109
110 1
    public function hasLocalFiles(): bool
111
    {
112 1
        return $this->video instanceof InputFile;
113
    }
114
115 1
    public function getLocalFiles(): Generator
116
    {
117 1
        yield 'video' => $this->video;
118 1
    }
119
}
120