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

SendVideoNote   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 69
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getMandatoryFields() 0 7 1
A hasLocalFiles() 0 4 1
A getLocalFiles() 0 4 1
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
 * As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video
14
 * messages. On success, the sent Message is returned
15
 *
16
 * Objects defined as-is May 2017
17
 *
18
 * @see https://core.telegram.org/bots/api#sendvideonote
19
 */
20
class SendVideoNote extends TelegramMethods
21
{
22
    /**
23
     * Unique identifier for the target chat or username of the target channel (in the format @channelusername)
24
     * @var string
25
     */
26
    public $chat_id = '';
27
28
    /**
29
     * Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers
30
     * (recommended) or upload a new video using multipart/form-data. Sending video notes by a URL is currently
31
     * unsupported
32
     * @see InputFile
33
     * @see https://core.telegram.org/bots/api#sending-files
34
     * @var string|InputFile
35
     */
36
    public $video_note = '';
37
38
    /**
39
     * Optional. Duration of sent video in seconds
40
     * @var int
41
     */
42
    public $duration = 0;
43
44
    /**
45
     * Video width and height
46
     * @var int
47
     */
48
    public $length = 0;
49
50
    /**
51
     * Optional. Sends the message silently. iOS users will not receive a notification, Android users will receive a
52
     * notification with no sound.
53
     * @see https://telegram.org/blog/channels-2-0#silent-messages
54
     * @var bool
55
     */
56
    public $disable_notification = false;
57
58
    /**
59
     * Optional. If the message is a reply, ID of the original message
60
     * @var int
61
     */
62
    public $reply_to_message_id = 0;
63
64
    /**
65
     * Optional. Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to
66
     * hide keyboard or to force a reply from the user
67
     * @var KeyboardMethods
68
     */
69
    public $reply_markup;
70
71
    public function getMandatoryFields(): array
72
    {
73
        return [
74
            'chat_id',
75
            'video_note',
76
        ];
77
    }
78
79
    public function hasLocalFiles(): bool
80
    {
81
        return $this->video_note instanceof InputFile;
82
    }
83
84
    public function getLocalFiles(): Generator
85
    {
86
        yield 'video_note' => $this->video_note;
87
    }
88
}
89