1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace TelegramBot\Api\Types\Inline\QueryResult; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Class InlineQueryResultVideo |
7
|
|
|
* Represents link to a page containing an embedded video player or a video file. |
8
|
|
|
* |
9
|
|
|
* @package TelegramBot\Api\Types\Inline |
10
|
|
|
*/ |
11
|
|
View Code Duplication |
class Video extends AbstractInlineQueryResult |
|
|
|
|
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* {@inheritdoc} |
15
|
|
|
* |
16
|
|
|
* @var array |
17
|
|
|
*/ |
18
|
|
|
static protected $requiredParams = ['type', 'id', 'video_url', 'mime_type', 'thumb_url']; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* {@inheritdoc} |
22
|
|
|
* |
23
|
|
|
* @var array |
24
|
|
|
*/ |
25
|
|
|
static protected $map = [ |
26
|
|
|
'type' => true, |
27
|
|
|
'id' => true, |
28
|
|
|
'video_url' => true, |
29
|
|
|
'mime_type' => true, |
30
|
|
|
'message_text' => true, |
31
|
|
|
'parse_mode' => true, |
32
|
|
|
'disable_web_page_preview' => true, |
33
|
|
|
'video_width' => true, |
34
|
|
|
'video_height' => true, |
35
|
|
|
'video_duration' => true, |
36
|
|
|
'thumb_url' => true, |
37
|
|
|
'title' => true, |
38
|
|
|
'description' => true, |
39
|
|
|
]; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* {@inheritdoc} |
43
|
|
|
* |
44
|
|
|
* @var string |
45
|
|
|
*/ |
46
|
|
|
protected $type = 'video'; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* A valid URL for the embedded video player or video file |
50
|
|
|
* |
51
|
|
|
* @var string |
52
|
|
|
*/ |
53
|
|
|
protected $videoUrl; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Mime type of the content of video url, “text/html” or “video/mp4” |
57
|
|
|
* |
58
|
|
|
* @var string |
59
|
|
|
*/ |
60
|
|
|
protected $mimeType; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Optional. Video width |
64
|
|
|
* |
65
|
|
|
* @var int |
66
|
|
|
*/ |
67
|
|
|
protected $videoWidth; |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Optional. Video height |
71
|
|
|
* |
72
|
|
|
* @var int |
73
|
|
|
*/ |
74
|
|
|
protected $videoHeight; |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Optional. Video duration in seconds |
78
|
|
|
* |
79
|
|
|
* @var int |
80
|
|
|
*/ |
81
|
|
|
protected $videoDuration; |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* URL of the thumbnail (jpeg only) for the video |
85
|
|
|
* |
86
|
|
|
* @var string |
87
|
|
|
*/ |
88
|
|
|
protected $thumbUrl; |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Optional. Short description of the result |
92
|
|
|
* |
93
|
|
|
* @var string |
94
|
|
|
*/ |
95
|
|
|
protected $description; |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* InlineQueryResultVideo constructor. |
99
|
|
|
* |
100
|
|
|
* @param string $id |
101
|
|
|
* @param string $videoUrl |
102
|
|
|
* @param string $thumbUrl |
103
|
|
|
* @param string $mimeType |
104
|
|
|
* @param string|null $messageText |
105
|
|
|
* @param string|null $parseMode |
106
|
|
|
* @param bool|null $disableWebPagePreview |
107
|
|
|
* @param int|null $videoWidth |
108
|
|
|
* @param int|null $videoHeight |
109
|
|
|
* @param int|null $videoDuration |
110
|
|
|
* @param string|null $title |
111
|
|
|
* @param string|null $description |
112
|
|
|
*/ |
113
|
|
|
public function __construct( |
114
|
|
|
$id, |
115
|
|
|
$videoUrl, |
116
|
|
|
$thumbUrl, |
117
|
|
|
$mimeType, |
118
|
|
|
$messageText = null, |
119
|
|
|
$parseMode = null, |
120
|
|
|
$disableWebPagePreview = null, |
121
|
|
|
$videoWidth = null, |
122
|
|
|
$videoHeight = null, |
123
|
|
|
$videoDuration = null, |
124
|
|
|
$title = null, |
125
|
|
|
$description = null |
126
|
|
|
) { |
127
|
|
|
parent::__construct($id, $title, $messageText, $parseMode, $disableWebPagePreview); |
|
|
|
|
128
|
|
|
|
129
|
|
|
$this->videoUrl = $videoUrl; |
130
|
|
|
$this->thumbUrl = $thumbUrl; |
131
|
|
|
$this->mimeType = $mimeType; |
132
|
|
|
$this->videoWidth = $videoWidth; |
133
|
|
|
$this->videoHeight = $videoHeight; |
134
|
|
|
$this->videoDuration = $videoDuration; |
135
|
|
|
$this->description = $description; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* @return string |
141
|
|
|
*/ |
142
|
|
|
public function getVideoUrl() |
143
|
|
|
{ |
144
|
|
|
return $this->videoUrl; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* @param string $videoUrl |
149
|
|
|
*/ |
150
|
|
|
public function setVideoUrl($videoUrl) |
151
|
|
|
{ |
152
|
|
|
$this->videoUrl = $videoUrl; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @return string |
157
|
|
|
*/ |
158
|
|
|
public function getMimeType() |
159
|
|
|
{ |
160
|
|
|
return $this->mimeType; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @param string $mimeType |
165
|
|
|
*/ |
166
|
|
|
public function setMimeType($mimeType) |
167
|
|
|
{ |
168
|
|
|
$this->mimeType = $mimeType; |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
/** |
172
|
|
|
* @return int |
173
|
|
|
*/ |
174
|
|
|
public function getVideoWidth() |
175
|
|
|
{ |
176
|
|
|
return $this->videoWidth; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* @param int $videoWidth |
181
|
|
|
*/ |
182
|
|
|
public function setVideoWidth($videoWidth) |
183
|
|
|
{ |
184
|
|
|
$this->videoWidth = $videoWidth; |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* @return int |
189
|
|
|
*/ |
190
|
|
|
public function getVideoHeight() |
191
|
|
|
{ |
192
|
|
|
return $this->videoHeight; |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
/** |
196
|
|
|
* @param int $videoHeight |
197
|
|
|
*/ |
198
|
|
|
public function setVideoHeight($videoHeight) |
199
|
|
|
{ |
200
|
|
|
$this->videoHeight = $videoHeight; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* @return int |
205
|
|
|
*/ |
206
|
|
|
public function getVideoDuration() |
207
|
|
|
{ |
208
|
|
|
return $this->videoDuration; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* @param int $videoDuration |
213
|
|
|
*/ |
214
|
|
|
public function setVideoDuration($videoDuration) |
215
|
|
|
{ |
216
|
|
|
$this->videoDuration = $videoDuration; |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* @return mixed |
221
|
|
|
*/ |
222
|
|
|
public function getThumbUrl() |
223
|
|
|
{ |
224
|
|
|
return $this->thumbUrl; |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* @param mixed $thumbUrl |
229
|
|
|
*/ |
230
|
|
|
public function setThumbUrl($thumbUrl) |
231
|
|
|
{ |
232
|
|
|
$this->thumbUrl = $thumbUrl; |
233
|
|
|
} |
234
|
|
|
|
235
|
|
|
/** |
236
|
|
|
* @return string |
237
|
|
|
*/ |
238
|
|
|
public function getDescription() |
239
|
|
|
{ |
240
|
|
|
return $this->description; |
241
|
|
|
} |
242
|
|
|
|
243
|
|
|
/** |
244
|
|
|
* @param string $description |
245
|
|
|
*/ |
246
|
|
|
public function setDescription($description) |
247
|
|
|
{ |
248
|
|
|
$this->description = $description; |
249
|
|
|
} |
250
|
|
|
} |
251
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.