1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace TelegramBot\Api\Types; |
4
|
|
|
|
5
|
|
|
use TelegramBot\Api\BaseType; |
6
|
|
|
use TelegramBot\Api\InvalidArgumentException; |
7
|
|
|
use TelegramBot\Api\TypeInterface; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class Video |
11
|
|
|
* This object represents a video file. |
12
|
|
|
* |
13
|
|
|
* @package TelegramBot\Api\Types |
14
|
|
|
*/ |
15
|
|
View Code Duplication |
class VideoNote extends BaseType implements TypeInterface |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* {@inheritdoc} |
19
|
|
|
* |
20
|
|
|
* @var array |
21
|
|
|
*/ |
22
|
|
|
static protected $requiredParams = ['file_id', 'length', 'duration']; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* {@inheritdoc} |
26
|
|
|
* |
27
|
|
|
* @var array |
28
|
|
|
*/ |
29
|
|
|
static protected $map = [ |
30
|
|
|
'file_id' => true, |
31
|
|
|
'length' => true, |
32
|
|
|
'duration' => true, |
33
|
|
|
'thumb' => PhotoSize::class, |
34
|
|
|
'file_size' => true |
35
|
|
|
]; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Unique identifier for this file |
39
|
|
|
* |
40
|
|
|
* @var string |
41
|
|
|
*/ |
42
|
|
|
protected $fileId; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Duration of the video note in seconds as defined by sender |
46
|
|
|
* |
47
|
|
|
* @var int |
48
|
|
|
*/ |
49
|
|
|
protected $duration; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Value of video width and height (diameter of the video message) as defined by sender |
53
|
|
|
* |
54
|
|
|
* @var int |
55
|
|
|
*/ |
56
|
|
|
protected $length; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Video Note thumbnail |
60
|
|
|
* |
61
|
|
|
* @var PhotoSize |
62
|
|
|
*/ |
63
|
|
|
protected $thumb; |
64
|
|
|
|
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Optional. File size |
68
|
|
|
* |
69
|
|
|
* @var int |
70
|
|
|
*/ |
71
|
|
|
protected $fileSize; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @return int |
75
|
|
|
*/ |
76
|
|
|
public function getDuration() |
77
|
|
|
{ |
78
|
|
|
return $this->duration; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @param int $duration |
83
|
|
|
* |
84
|
|
|
* @throws InvalidArgumentException |
85
|
|
|
*/ |
86
|
|
|
public function setDuration($duration) |
87
|
|
|
{ |
88
|
|
|
if (is_integer($duration)) { |
89
|
|
|
$this->duration = $duration; |
90
|
|
|
} else { |
91
|
|
|
throw new InvalidArgumentException(); |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @return string |
97
|
|
|
*/ |
98
|
|
|
public function getFileId() |
99
|
|
|
{ |
100
|
|
|
return $this->fileId; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @param string $fileId |
105
|
|
|
*/ |
106
|
|
|
public function setFileId($fileId) |
107
|
|
|
{ |
108
|
|
|
$this->fileId = $fileId; |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* @return int |
113
|
|
|
*/ |
114
|
|
|
public function getFileSize() |
115
|
|
|
{ |
116
|
|
|
return $this->fileSize; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* @param int $fileSize |
121
|
|
|
* |
122
|
|
|
* @throws InvalidArgumentException |
123
|
|
|
*/ |
124
|
|
|
public function setFileSize($fileSize) |
125
|
|
|
{ |
126
|
|
|
if (is_integer($fileSize)) { |
127
|
|
|
$this->fileSize = $fileSize; |
128
|
|
|
} else { |
129
|
|
|
throw new InvalidArgumentException(); |
130
|
|
|
} |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* @return int |
135
|
|
|
*/ |
136
|
|
|
public function getLength() |
137
|
|
|
{ |
138
|
|
|
return $this->length; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* @param int $length |
143
|
|
|
* |
144
|
|
|
* @throws InvalidArgumentException |
145
|
|
|
*/ |
146
|
|
|
public function setLength($length) |
147
|
|
|
{ |
148
|
|
|
if (is_integer($length)) { |
149
|
|
|
$this->length = $length; |
150
|
|
|
} else { |
151
|
|
|
throw new InvalidArgumentException(); |
152
|
|
|
} |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @return PhotoSize |
157
|
|
|
*/ |
158
|
|
|
public function getThumb() |
159
|
|
|
{ |
160
|
|
|
return $this->thumb; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @param PhotoSize $thumb |
165
|
|
|
*/ |
166
|
|
|
public function setThumb(PhotoSize $thumb) |
167
|
|
|
{ |
168
|
|
|
$this->thumb = $thumb; |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
} |
172
|
|
|
|