1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Created by PhpStorm. |
4
|
|
|
* User: iGusev |
5
|
|
|
* Date: 18/04/16 |
6
|
|
|
* Time: 04:19 |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace TelegramBot\Api\Types\Inline\QueryResult; |
10
|
|
|
|
11
|
|
|
use TelegramBot\Api\Types\Inline\InlineKeyboardMarkup; |
12
|
|
|
use TelegramBot\Api\Types\Inline\InputMessageContent; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Class Venue |
16
|
|
|
* |
17
|
|
|
* @see https://core.telegram.org/bots/api#inlinequeryresultvenue |
18
|
|
|
* Represents a venue. By default, the venue will be sent by the user. |
19
|
|
|
* Alternatively, you can use InputMessageContent to send a message with the specified content instead of the venue. |
20
|
|
|
* |
21
|
|
|
* Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. |
22
|
|
|
* |
23
|
|
|
* @package TelegramBot\Api\Types\Inline\QueryResult |
24
|
|
|
*/ |
25
|
|
|
class Venue extends AbstractInlineQueryResult |
26
|
|
|
{ |
27
|
|
|
/** |
28
|
|
|
* {@inheritdoc} |
29
|
|
|
* |
30
|
|
|
* @var array |
31
|
|
|
*/ |
32
|
|
|
protected static $requiredParams = ['type', 'id', 'latitude', 'longitude', 'title', 'address']; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* {@inheritdoc} |
36
|
|
|
* |
37
|
|
|
* @var array |
38
|
|
|
*/ |
39
|
|
|
protected static $map = [ |
40
|
|
|
'type' => true, |
41
|
|
|
'id' => true, |
42
|
|
|
'latitude' => true, |
43
|
|
|
'longitude' => true, |
44
|
|
|
'title' => true, |
45
|
|
|
'address' => true, |
46
|
|
|
'foursquare_id' => true, |
47
|
|
|
'thumbnail_url' => true, |
48
|
|
|
'thumbnail_width' => true, |
49
|
|
|
'thumbnail_height' => true, |
50
|
|
|
'reply_markup' => InlineKeyboardMarkup::class, |
51
|
|
|
'input_message_content' => InputMessageContent::class, |
52
|
|
|
]; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* {@inheritdoc} |
56
|
|
|
* |
57
|
|
|
* @var string |
58
|
|
|
*/ |
59
|
|
|
protected $type = 'venue'; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Latitude of the venue location in degrees |
63
|
|
|
* |
64
|
|
|
* @var float |
65
|
|
|
*/ |
66
|
|
|
protected $latitude; |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Longitude of the venue location in degrees |
70
|
|
|
* |
71
|
|
|
* @var float |
72
|
|
|
*/ |
73
|
|
|
protected $longitude; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Optional. Thumbnail width |
77
|
|
|
* |
78
|
|
|
* @var string|null |
79
|
|
|
*/ |
80
|
|
|
protected $address; |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Optional. Url of the thumbnail for the result |
84
|
|
|
* |
85
|
|
|
* @var string|null |
86
|
|
|
*/ |
87
|
|
|
protected $thumbnailUrl; |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Optional. Thumbnail width |
91
|
|
|
* |
92
|
|
|
* @var int|null |
93
|
|
|
*/ |
94
|
|
|
protected $thumbnailWidth; |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* Optional. Thumbnail height |
98
|
|
|
* |
99
|
|
|
* @var int|null |
100
|
|
|
*/ |
101
|
|
|
protected $thumbnailHeight; |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* Optional. Foursquare identifier of the venue if known |
105
|
|
|
* |
106
|
|
|
* @var string|null |
107
|
|
|
*/ |
108
|
|
|
protected $foursquareId; |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* Voice constructor |
112
|
|
|
* |
113
|
|
|
* @param string $id |
114
|
|
|
* @param float $latitude |
115
|
|
|
* @param float $longitude |
116
|
|
|
* @param string $title |
117
|
|
|
* @param string $address |
118
|
|
|
* @param string|null $thumbnailUrl |
119
|
|
|
* @param int|null $thumbnailWidth |
120
|
|
|
* @param int|null $thumbnailHeight |
121
|
|
|
* @param string|null $foursquareId |
122
|
|
|
* @param InlineKeyboardMarkup|null $inlineKeyboardMarkup |
123
|
|
|
* @param InputMessageContent|null $inputMessageContent |
124
|
|
|
*/ |
125
|
|
|
public function __construct( |
126
|
|
|
$id, |
127
|
|
|
$latitude, |
128
|
|
|
$longitude, |
129
|
|
|
$title, |
130
|
|
|
$address, |
131
|
|
|
$thumbnailUrl = null, |
132
|
|
|
$thumbnailWidth = null, |
133
|
|
|
$thumbnailHeight = null, |
134
|
|
|
$foursquareId = null, |
135
|
|
|
$inputMessageContent = null, |
136
|
|
|
$inlineKeyboardMarkup = null |
137
|
|
|
) { |
138
|
|
|
parent::__construct($id, $title, $inputMessageContent, $inlineKeyboardMarkup); |
139
|
|
|
|
140
|
|
|
$this->latitude = $latitude; |
141
|
|
|
$this->longitude = $longitude; |
142
|
|
|
$this->address = $address; |
143
|
|
|
$this->thumbnailUrl = $thumbnailUrl; |
144
|
|
|
$this->thumbnailWidth = $thumbnailWidth; |
145
|
|
|
$this->thumbnailHeight = $thumbnailHeight; |
146
|
|
|
$this->foursquareId = $foursquareId; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* @return float |
151
|
|
|
*/ |
152
|
|
|
public function getLatitude() |
153
|
|
|
{ |
154
|
|
|
return $this->latitude; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* @param float $latitude |
159
|
|
|
* |
160
|
|
|
* @return void |
161
|
|
|
*/ |
162
|
|
|
public function setLatitude($latitude) |
163
|
|
|
{ |
164
|
|
|
$this->latitude = $latitude; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* @return float |
169
|
|
|
*/ |
170
|
|
|
public function getLongitude() |
171
|
|
|
{ |
172
|
|
|
return $this->longitude; |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
/** |
176
|
|
|
* @param float $longitude |
177
|
|
|
* |
178
|
|
|
* @return void |
179
|
|
|
*/ |
180
|
|
|
public function setLongitude($longitude) |
181
|
|
|
{ |
182
|
|
|
$this->longitude = $longitude; |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* @return string|null |
187
|
|
|
*/ |
188
|
|
|
public function getAddress() |
189
|
|
|
{ |
190
|
|
|
return $this->address; |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
/** |
194
|
|
|
* @param string|null $address |
195
|
|
|
* |
196
|
|
|
* @return void |
197
|
|
|
*/ |
198
|
|
|
public function setAddress($address) |
199
|
|
|
{ |
200
|
|
|
$this->address = $address; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* @return string|null |
205
|
|
|
*/ |
206
|
|
|
public function getFoursquareId() |
207
|
|
|
{ |
208
|
|
|
return $this->foursquareId; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* @param string|null $foursquareId |
213
|
|
|
* |
214
|
|
|
* @return void |
215
|
|
|
*/ |
216
|
|
|
public function setFoursquareId($foursquareId) |
217
|
|
|
{ |
218
|
|
|
$this->foursquareId = $foursquareId; |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
/** |
222
|
|
|
* @return string|null |
223
|
|
|
*/ |
224
|
|
|
public function getThumbnailUrl() |
225
|
|
|
{ |
226
|
|
|
return $this->thumbnailUrl; |
227
|
|
|
} |
228
|
|
|
|
229
|
|
|
/** |
230
|
|
|
* @param string|null $thumbnailUrl |
231
|
|
|
* |
232
|
|
|
* @return void |
233
|
|
|
*/ |
234
|
|
|
public function setThumbnailUrl($thumbnailUrl) |
235
|
|
|
{ |
236
|
|
|
$this->thumbnailUrl = $thumbnailUrl; |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
/** |
240
|
|
|
* @deprecated Use getThumbnailUrl |
241
|
|
|
* |
242
|
|
|
* @return string|null |
243
|
|
|
*/ |
244
|
|
|
public function getThumbUrl() |
245
|
|
|
{ |
246
|
|
|
return $this->getThumbnailUrl(); |
247
|
|
|
} |
248
|
|
|
|
249
|
|
|
/** |
250
|
|
|
* @deprecated Use setThumbnailUrl |
251
|
|
|
* |
252
|
|
|
* @param string|null $thumbUrl |
253
|
|
|
* |
254
|
|
|
* @return void |
255
|
|
|
*/ |
256
|
|
|
public function setThumbUrl($thumbUrl) |
257
|
|
|
{ |
258
|
|
|
$this->setThumbnailUrl($thumbUrl); |
259
|
|
|
} |
260
|
|
|
|
261
|
|
|
/** |
262
|
|
|
* @return int|null |
263
|
|
|
*/ |
264
|
|
|
public function getThumbnailWidth() |
265
|
|
|
{ |
266
|
|
|
return $this->thumbnailWidth; |
267
|
|
|
} |
268
|
|
|
|
269
|
|
|
/** |
270
|
|
|
* @param int|null $thumbnailWidth |
271
|
|
|
* |
272
|
|
|
* @return void |
273
|
|
|
*/ |
274
|
|
|
public function setThumbnailWidth($thumbnailWidth) |
275
|
|
|
{ |
276
|
|
|
$this->thumbnailWidth = $thumbnailWidth; |
277
|
|
|
} |
278
|
|
|
|
279
|
|
|
/** |
280
|
|
|
* @deprecated Use getThumbnailWidth |
281
|
|
|
* |
282
|
|
|
* @return int|null |
283
|
|
|
*/ |
284
|
|
|
public function getThumbWidth() |
285
|
|
|
{ |
286
|
|
|
return $this->getThumbnailWidth(); |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
/** |
290
|
|
|
* @deprecated Use setThumbnailWidth |
291
|
|
|
* |
292
|
|
|
* @param int|null $thumbWidth |
293
|
|
|
* |
294
|
|
|
* @return void |
295
|
|
|
*/ |
296
|
|
|
public function setThumbWidth($thumbWidth) |
297
|
|
|
{ |
298
|
|
|
$this->setThumbnailWidth($thumbWidth); |
299
|
|
|
} |
300
|
|
|
|
301
|
|
|
/** |
302
|
|
|
* @return int|null |
303
|
|
|
*/ |
304
|
|
|
public function getThumbnailHeight() |
305
|
|
|
{ |
306
|
|
|
return $this->thumbnailHeight; |
307
|
|
|
} |
308
|
|
|
|
309
|
|
|
/** |
310
|
|
|
* @param int|null $thumbnailHeight |
311
|
|
|
* |
312
|
|
|
* @return void |
313
|
|
|
*/ |
314
|
|
|
public function setThumbnailHeight($thumbnailHeight) |
315
|
|
|
{ |
316
|
|
|
$this->thumbnailHeight = $thumbnailHeight; |
317
|
|
|
} |
318
|
|
|
|
319
|
|
|
/** |
320
|
|
|
* @deprecated Use getThumbnailHeight |
321
|
|
|
* |
322
|
|
|
* @return int|null |
323
|
|
|
*/ |
324
|
|
|
public function getThumbHeight() |
325
|
|
|
{ |
326
|
|
|
return $this->getThumbnailHeight(); |
327
|
|
|
} |
328
|
|
|
|
329
|
|
|
/** |
330
|
|
|
* @deprecated Use setThumbnailWidth |
331
|
|
|
* |
332
|
|
|
* @param int|null $thumbHeight |
333
|
|
|
* |
334
|
|
|
* @return void |
335
|
|
|
*/ |
336
|
|
|
public function setThumbHeight($thumbHeight) |
337
|
|
|
{ |
338
|
|
|
$this->setThumbnailHeight($thumbHeight); |
339
|
|
|
} |
340
|
|
|
} |
341
|
|
|
|