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 Animation |
11
|
|
|
* This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound). |
12
|
|
|
* |
13
|
|
|
* @package TelegramBot\Api\Types |
14
|
|
|
*/ |
15
|
|
|
class Animation extends BaseType implements TypeInterface |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* {@inheritdoc} |
19
|
|
|
* |
20
|
|
|
* @var array |
21
|
|
|
*/ |
22
|
|
|
static protected $requiredParams = ['file_id', 'width', 'height', 'duration']; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* {@inheritdoc} |
26
|
|
|
* |
27
|
|
|
* @var array |
28
|
|
|
*/ |
29
|
|
|
static protected $map = [ |
30
|
|
|
'file_id' => true, |
31
|
|
|
'width' => true, |
32
|
|
|
'height' => true, |
33
|
|
|
'duration' => true, |
34
|
|
|
'thumb' => PhotoSize::class, |
35
|
|
|
'file_name' => true, |
36
|
|
|
'mime_type' => true, |
37
|
|
|
'file_size' => true |
38
|
|
|
]; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Unique file identifier |
42
|
|
|
* |
43
|
|
|
* @var string |
44
|
|
|
*/ |
45
|
|
|
protected $fileId; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Video width as defined by sender |
49
|
|
|
* |
50
|
|
|
* @var int |
51
|
|
|
*/ |
52
|
|
|
protected $width; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Video height as defined by sender |
56
|
|
|
* |
57
|
|
|
* @var int |
58
|
|
|
*/ |
59
|
|
|
protected $height; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Duration of the video in seconds as defined by sender |
63
|
|
|
* |
64
|
|
|
* @var int |
65
|
|
|
*/ |
66
|
|
|
protected $duration; |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Video thumbnail |
70
|
|
|
* |
71
|
|
|
* @var PhotoSize |
72
|
|
|
*/ |
73
|
|
|
protected $thumb; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Optional. Animation thumbnail as defined by sender |
77
|
|
|
* |
78
|
|
|
* @var PhotoSize |
79
|
|
|
*/ |
80
|
|
|
protected $fileName; |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Optional. Mime type of a file as defined by sender |
84
|
|
|
* |
85
|
|
|
* @var string |
86
|
|
|
*/ |
87
|
|
|
protected $mimeType; |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Optional. File size |
91
|
|
|
* |
92
|
|
|
* @var int |
93
|
|
|
*/ |
94
|
|
|
protected $fileSize; |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @return int |
98
|
|
|
*/ |
99
|
|
|
public function getDuration() |
100
|
|
|
{ |
101
|
|
|
return $this->duration; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @param int $duration |
106
|
|
|
* |
107
|
|
|
* @throws InvalidArgumentException |
108
|
|
|
*/ |
109
|
|
|
public function setDuration($duration) |
110
|
|
|
{ |
111
|
|
|
if (is_integer($duration)) { |
112
|
|
|
$this->duration = $duration; |
113
|
|
|
} else { |
114
|
|
|
throw new InvalidArgumentException(); |
115
|
|
|
} |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @return string |
120
|
|
|
*/ |
121
|
|
|
public function getFileId() |
122
|
|
|
{ |
123
|
|
|
return $this->fileId; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @param string $fileId |
128
|
|
|
*/ |
129
|
|
|
public function setFileId($fileId) |
130
|
|
|
{ |
131
|
|
|
$this->fileId = $fileId; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* @return int |
136
|
|
|
*/ |
137
|
|
|
public function getFileSize() |
138
|
|
|
{ |
139
|
|
|
return $this->fileSize; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* @param int $fileSize |
144
|
|
|
* |
145
|
|
|
* @throws InvalidArgumentException |
146
|
|
|
*/ |
147
|
|
|
public function setFileSize($fileSize) |
148
|
|
|
{ |
149
|
|
|
if (is_integer($fileSize)) { |
150
|
|
|
$this->fileSize = $fileSize; |
151
|
|
|
} else { |
152
|
|
|
throw new InvalidArgumentException(); |
153
|
|
|
} |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* @return int |
158
|
|
|
*/ |
159
|
|
|
public function getHeight() |
160
|
|
|
{ |
161
|
|
|
return $this->height; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* @param int $height |
166
|
|
|
* |
167
|
|
|
* @throws InvalidArgumentException |
168
|
|
|
*/ |
169
|
|
|
public function setHeight($height) |
170
|
|
|
{ |
171
|
|
|
if (is_integer($height)) { |
172
|
|
|
$this->height = $height; |
173
|
|
|
} else { |
174
|
|
|
throw new InvalidArgumentException(); |
175
|
|
|
} |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* @return string |
180
|
|
|
*/ |
181
|
|
|
public function getMimeType() |
182
|
|
|
{ |
183
|
|
|
return $this->mimeType; |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* @param string $mimeType |
188
|
|
|
*/ |
189
|
|
|
public function setMimeType($mimeType) |
190
|
|
|
{ |
191
|
|
|
$this->mimeType = $mimeType; |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
/** |
195
|
|
|
* @return PhotoSize |
196
|
|
|
*/ |
197
|
|
|
public function getThumb() |
198
|
|
|
{ |
199
|
|
|
return $this->thumb; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* @param PhotoSize $thumb |
204
|
|
|
*/ |
205
|
|
|
public function setThumb(PhotoSize $thumb) |
206
|
|
|
{ |
207
|
|
|
$this->thumb = $thumb; |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
/** |
211
|
|
|
* @return string $fileName |
212
|
|
|
*/ |
213
|
|
|
public function getFileName() |
214
|
|
|
{ |
215
|
|
|
return $this->fileName; |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
/** |
219
|
|
|
* @param string $fileName |
220
|
|
|
*/ |
221
|
|
|
public function setFileName($fileName) |
222
|
|
|
{ |
223
|
|
|
$this->fileName = $fileName; |
|
|
|
|
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* @return int |
228
|
|
|
*/ |
229
|
|
|
public function getWidth() |
230
|
|
|
{ |
231
|
|
|
return $this->width; |
232
|
|
|
} |
233
|
|
|
|
234
|
|
|
/** |
235
|
|
|
* @param int $width |
236
|
|
|
* |
237
|
|
|
* @throws InvalidArgumentException |
238
|
|
|
*/ |
239
|
|
|
public function setWidth($width) |
240
|
|
|
{ |
241
|
|
|
if (is_integer($width)) { |
242
|
|
|
$this->width = $width; |
243
|
|
|
} else { |
244
|
|
|
throw new InvalidArgumentException(); |
245
|
|
|
} |
246
|
|
|
} |
247
|
|
|
} |
248
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..