|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace TelegramBot\Api\Types\Inline\QueryResult; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Class InlineQueryResultMpeg4Gif |
|
7
|
|
|
* Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). |
|
8
|
|
|
* By default, this animated MPEG-4 file will be sent by the user with optional caption. |
|
9
|
|
|
* Alternatively, you can provide message_text to send it instead of the animation. |
|
10
|
|
|
* |
|
11
|
|
|
* @package TelegramBot\Api\Types\Inline |
|
12
|
|
|
*/ |
|
13
|
|
View Code Duplication |
class Mpeg4Gif extends AbstractInlineQueryResult |
|
|
|
|
|
|
14
|
|
|
{ |
|
15
|
|
|
/** |
|
16
|
|
|
* {@inheritdoc} |
|
17
|
|
|
* |
|
18
|
|
|
* @var array |
|
19
|
|
|
*/ |
|
20
|
|
|
static protected $requiredParams = ['type', 'id', 'mpeg4_url', 'thumb_url']; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* {@inheritdoc} |
|
24
|
|
|
* |
|
25
|
|
|
* @var array |
|
26
|
|
|
*/ |
|
27
|
|
|
static protected $map = [ |
|
28
|
|
|
'type' => true, |
|
29
|
|
|
'id' => true, |
|
30
|
|
|
'mpeg4_url' => true, |
|
31
|
|
|
'mpeg4_width' => true, |
|
32
|
|
|
'mpeg4_height' => true, |
|
33
|
|
|
'thumb_url' => true, |
|
34
|
|
|
'title' => true, |
|
35
|
|
|
'caption' => true, |
|
36
|
|
|
'message_text' => true, |
|
37
|
|
|
'parse_mode' => true, |
|
38
|
|
|
'disable_web_page_preview' => true, |
|
39
|
|
|
]; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* {@inheritdoc} |
|
43
|
|
|
* |
|
44
|
|
|
* @var string |
|
45
|
|
|
*/ |
|
46
|
|
|
protected $type = 'mpeg4_gif'; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* A valid URL for the MP4 file. File size must not exceed 1MB |
|
50
|
|
|
* |
|
51
|
|
|
* @var string |
|
52
|
|
|
*/ |
|
53
|
|
|
protected $mpeg4Url; |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* Optional. Video width |
|
57
|
|
|
* |
|
58
|
|
|
* @var int |
|
59
|
|
|
*/ |
|
60
|
|
|
protected $mpeg4Width; |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* Optional. Video height |
|
64
|
|
|
* |
|
65
|
|
|
* @var int |
|
66
|
|
|
*/ |
|
67
|
|
|
protected $mpeg4Height; |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* URL of the static thumbnail (jpeg or gif) for the result |
|
71
|
|
|
* |
|
72
|
|
|
* @var string |
|
73
|
|
|
*/ |
|
74
|
|
|
protected $thumbUrl; |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* Optional. Caption of the MPEG-4 file to be sent, 0-200 characters |
|
78
|
|
|
* |
|
79
|
|
|
* @var string |
|
80
|
|
|
*/ |
|
81
|
|
|
protected $caption; |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* InlineQueryResultMpeg4Gif constructor. |
|
85
|
|
|
* |
|
86
|
|
|
* @param string $id |
|
87
|
|
|
* @param string $mpeg4Url |
|
88
|
|
|
* @param string $thumbUrl |
|
89
|
|
|
* @param int|null $mpeg4Width |
|
90
|
|
|
* @param int|null $mpeg4Height |
|
91
|
|
|
* @param string|null $caption |
|
92
|
|
|
* @param string|null $title |
|
93
|
|
|
* @param string|null $messageText |
|
94
|
|
|
* @param string|null $parseMode |
|
95
|
|
|
* @param bool|null $disableWebPagePreview |
|
96
|
|
|
*/ |
|
97
|
|
|
public function __construct( |
|
98
|
|
|
$id, |
|
99
|
|
|
$mpeg4Url, |
|
100
|
|
|
$thumbUrl, |
|
101
|
|
|
$mpeg4Width = null, |
|
102
|
|
|
$mpeg4Height = null, |
|
103
|
|
|
$caption = null, |
|
104
|
|
|
$title = null, |
|
105
|
|
|
$messageText = null, |
|
106
|
|
|
$parseMode = null, |
|
107
|
|
|
$disableWebPagePreview = null |
|
108
|
|
|
) { |
|
109
|
|
|
parent::__construct($id, $title, $messageText, $parseMode, $disableWebPagePreview); |
|
|
|
|
|
|
110
|
|
|
|
|
111
|
|
|
$this->mpeg4Url = $mpeg4Url; |
|
112
|
|
|
$this->thumbUrl = $thumbUrl; |
|
113
|
|
|
$this->mpeg4Width = $mpeg4Width; |
|
114
|
|
|
$this->mpeg4Height = $mpeg4Height; |
|
115
|
|
|
$this->caption = $caption; |
|
116
|
|
|
} |
|
117
|
|
|
|
|
118
|
|
|
|
|
119
|
|
|
/** |
|
120
|
|
|
* @return string |
|
121
|
|
|
*/ |
|
122
|
|
|
public function getMpeg4Url() |
|
123
|
|
|
{ |
|
124
|
|
|
return $this->mpeg4Url; |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* @param string $mpeg4Url |
|
129
|
|
|
*/ |
|
130
|
|
|
public function setMpeg4Url($mpeg4Url) |
|
131
|
|
|
{ |
|
132
|
|
|
$this->mpeg4Url = $mpeg4Url; |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
/** |
|
136
|
|
|
* @return int |
|
137
|
|
|
*/ |
|
138
|
|
|
public function getMpeg4Width() |
|
139
|
|
|
{ |
|
140
|
|
|
return $this->mpeg4Width; |
|
141
|
|
|
} |
|
142
|
|
|
|
|
143
|
|
|
/** |
|
144
|
|
|
* @param int $mpeg4Width |
|
145
|
|
|
*/ |
|
146
|
|
|
public function setMpeg4Width($mpeg4Width) |
|
147
|
|
|
{ |
|
148
|
|
|
$this->mpeg4Width = $mpeg4Width; |
|
149
|
|
|
} |
|
150
|
|
|
|
|
151
|
|
|
/** |
|
152
|
|
|
* @return int |
|
153
|
|
|
*/ |
|
154
|
|
|
public function getMpeg4Height() |
|
155
|
|
|
{ |
|
156
|
|
|
return $this->mpeg4Height; |
|
157
|
|
|
} |
|
158
|
|
|
|
|
159
|
|
|
/** |
|
160
|
|
|
* @param int $mpeg4Height |
|
161
|
|
|
*/ |
|
162
|
|
|
public function setMpeg4Height($mpeg4Height) |
|
163
|
|
|
{ |
|
164
|
|
|
$this->mpeg4Height = $mpeg4Height; |
|
165
|
|
|
} |
|
166
|
|
|
|
|
167
|
|
|
/** |
|
168
|
|
|
* @return string |
|
169
|
|
|
*/ |
|
170
|
|
|
public function getThumbUrl() |
|
171
|
|
|
{ |
|
172
|
|
|
return $this->thumbUrl; |
|
173
|
|
|
} |
|
174
|
|
|
|
|
175
|
|
|
/** |
|
176
|
|
|
* @param string $thumbUrl |
|
177
|
|
|
*/ |
|
178
|
|
|
public function setThumbUrl($thumbUrl) |
|
179
|
|
|
{ |
|
180
|
|
|
$this->thumbUrl = $thumbUrl; |
|
181
|
|
|
} |
|
182
|
|
|
|
|
183
|
|
|
/** |
|
184
|
|
|
* @return string |
|
185
|
|
|
*/ |
|
186
|
|
|
public function getCaption() |
|
187
|
|
|
{ |
|
188
|
|
|
return $this->caption; |
|
189
|
|
|
} |
|
190
|
|
|
|
|
191
|
|
|
/** |
|
192
|
|
|
* @param string $caption |
|
193
|
|
|
*/ |
|
194
|
|
|
public function setCaption($caption) |
|
195
|
|
|
{ |
|
196
|
|
|
$this->caption = $caption; |
|
197
|
|
|
} |
|
198
|
|
|
} |
|
199
|
|
|
|
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.