1
|
|
|
<?php |
2
|
|
|
namespace TelegramBot\Api\Types; |
3
|
|
|
|
4
|
|
|
use TelegramBot\Api\BaseType; |
5
|
|
|
use TelegramBot\Api\InvalidArgumentException; |
6
|
|
|
use TelegramBot\Api\TypeInterface; |
7
|
|
|
use TelegramBot\Api\Types\Payments\Invoice; |
8
|
|
|
use TelegramBot\Api\Types\Payments\SuccessfulPayment; |
9
|
|
|
|
10
|
|
|
class Message extends BaseType implements TypeInterface |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* {@inheritdoc} |
14
|
|
|
* |
15
|
|
|
* @var array |
16
|
|
|
*/ |
17
|
|
|
static protected $requiredParams = ['message_id', 'date', 'chat']; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* {@inheritdoc} |
21
|
|
|
* |
22
|
|
|
* @var array |
23
|
|
|
*/ |
24
|
|
|
static protected $map = [ |
25
|
|
|
'message_id' => true, |
26
|
|
|
'from' => User::class, |
27
|
|
|
'date' => true, |
28
|
|
|
'chat' => Chat::class, |
29
|
|
|
'forward_from' => User::class, |
30
|
|
|
'forward_from_chat' => Chat::class, |
31
|
|
|
'forward_from_message_id' => true, |
32
|
|
|
'forward_date' => true, |
33
|
|
|
'reply_to_message' => Message::class, |
34
|
|
|
'text' => true, |
35
|
|
|
'entities' => ArrayOfMessageEntity::class, |
36
|
|
|
'caption_entities' => ArrayOfMessageEntity::class, |
37
|
|
|
'audio' => Audio::class, |
38
|
|
|
'document' => Document::class, |
39
|
|
|
'photo' => ArrayOfPhotoSize::class, |
40
|
|
|
'media_group_id' => true, |
41
|
|
|
'sticker' => Sticker::class, |
42
|
|
|
'video' => Video::class, |
43
|
|
|
'voice' => Voice::class, |
44
|
|
|
'caption' => true, |
45
|
|
|
'contact' => Contact::class, |
46
|
|
|
'location' => Location::class, |
47
|
|
|
'venue' => Venue::class, |
48
|
|
|
'new_chat_member' => User::class, |
49
|
|
|
'left_chat_member' => User::class, |
50
|
|
|
'new_chat_title' => true, |
51
|
|
|
'new_chat_photo' => ArrayOfPhotoSize::class, |
52
|
|
|
'delete_chat_photo' => true, |
53
|
|
|
'group_chat_created' => true, |
54
|
|
|
'supergroup_chat_created' => true, |
55
|
|
|
'channel_chat_created' => true, |
56
|
|
|
'migrate_to_chat_id' => true, |
57
|
|
|
'migrate_from_chat_id' => true, |
58
|
|
|
'pinned_message' => Message::class, |
59
|
|
|
'invoice' => Invoice::class, |
60
|
|
|
'successful_payment' => SuccessfulPayment::class, |
61
|
|
|
'forward_signature' => true, |
62
|
|
|
'author_signature' => true, |
63
|
|
|
'connected_website' => true |
64
|
|
|
]; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Unique message identifier |
68
|
|
|
* |
69
|
|
|
* @var int |
70
|
|
|
*/ |
71
|
|
|
protected $messageId; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Optional. Sender name. Can be empty for messages sent to channels |
75
|
|
|
* |
76
|
|
|
* @var \TelegramBot\Api\Types\User |
77
|
|
|
*/ |
78
|
|
|
protected $from; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Date the message was sent in Unix time |
82
|
|
|
* |
83
|
|
|
* @var int |
84
|
|
|
*/ |
85
|
|
|
protected $date; |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Conversation the message belongs to — user in case of a private message, GroupChat in case of a group |
89
|
|
|
* |
90
|
|
|
* @var \TelegramBot\Api\Types\Chat |
91
|
|
|
*/ |
92
|
|
|
protected $chat; |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Optional. For forwarded messages, sender of the original message |
96
|
|
|
* |
97
|
|
|
* @var \TelegramBot\Api\Types\User |
98
|
|
|
*/ |
99
|
|
|
protected $forwardFrom; |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* Optional. For messages forwarded from channels, information about |
103
|
|
|
* the original channel |
104
|
|
|
* |
105
|
|
|
* @var \TelegramBot\Api\Types\Chat |
106
|
|
|
*/ |
107
|
|
|
protected $forwardFromChat; |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* Optional. For messages forwarded from channels, identifier of |
111
|
|
|
* the original message in the channel |
112
|
|
|
* |
113
|
|
|
* @var int |
114
|
|
|
*/ |
115
|
|
|
protected $forwardFromMessageId; |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* Optional. For forwarded messages, date the original message was sent in Unix time |
119
|
|
|
* |
120
|
|
|
* @var int |
121
|
|
|
*/ |
122
|
|
|
protected $forwardDate; |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* Optional. For replies, the original message. Note that the Message object in this field will not contain further |
126
|
|
|
* reply_to_message fields even if it itself is a reply. |
127
|
|
|
* |
128
|
|
|
* @var \TelegramBot\Api\Types\Message |
129
|
|
|
*/ |
130
|
|
|
protected $replyToMessage; |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* Optional. For text messages, the actual UTF-8 text of the message |
134
|
|
|
* |
135
|
|
|
* @var string |
136
|
|
|
*/ |
137
|
|
|
protected $text; |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text. |
141
|
|
|
* array of \TelegramBot\Api\Types\MessageEntity |
142
|
|
|
* |
143
|
|
|
* @var array |
144
|
|
|
*/ |
145
|
|
|
protected $entities; |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* Optional. Message is an audio file, information about the file |
149
|
|
|
* |
150
|
|
|
* @var \TelegramBot\Api\Types\Audio |
151
|
|
|
*/ |
152
|
|
|
protected $audio; |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* Optional. Message is a general file, information about the file |
156
|
|
|
* |
157
|
|
|
* @var \TelegramBot\Api\Types\Document |
158
|
|
|
*/ |
159
|
|
|
protected $document; |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* Optional. Message is a photo, available sizes of the photo |
163
|
|
|
* array of \TelegramBot\Api\Types\Photo |
164
|
|
|
* |
165
|
|
|
* @var array |
166
|
|
|
*/ |
167
|
|
|
protected $photo; |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* Optional. The unique identifier of a media message group |
171
|
|
|
* this message belongs to |
172
|
|
|
* |
173
|
|
|
* @var int |
174
|
|
|
*/ |
175
|
|
|
protected $mediaGroupId; |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* Optional. Message is a sticker, information about the sticker |
179
|
|
|
* |
180
|
|
|
* @var \TelegramBot\Api\Types\Sticker |
181
|
|
|
*/ |
182
|
|
|
protected $sticker; |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* Optional. Message is a video, information about the video |
186
|
|
|
* |
187
|
|
|
* @var \TelegramBot\Api\Types\Video |
188
|
|
|
*/ |
189
|
|
|
protected $video; |
190
|
|
|
|
191
|
|
|
/** |
192
|
|
|
* Optional. Message is a voice message, information about the file |
193
|
|
|
* |
194
|
|
|
* @var \TelegramBot\Api\Types\Voice |
195
|
|
|
*/ |
196
|
|
|
protected $voice; |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* Optional. Message is a shared contact, information about the contact |
200
|
|
|
* |
201
|
|
|
* @var \TelegramBot\Api\Types\Contact |
202
|
|
|
*/ |
203
|
|
|
protected $contact; |
204
|
|
|
|
205
|
|
|
/** |
206
|
|
|
* Optional. Message is a shared location, information about the location |
207
|
|
|
* |
208
|
|
|
* @var \TelegramBot\Api\Types\Location |
209
|
|
|
*/ |
210
|
|
|
protected $location; |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* Optional. Message is a venue, information about the venue |
214
|
|
|
* |
215
|
|
|
* @var \TelegramBot\Api\Types\Venue |
216
|
|
|
*/ |
217
|
|
|
protected $venue; |
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* Optional. A new member was added to the group, information about them (this member may be bot itself) |
221
|
|
|
* |
222
|
|
|
* @var \TelegramBot\Api\Types\User |
223
|
|
|
*/ |
224
|
|
|
protected $newChatMember; |
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* Optional. A member was removed from the group, information about them (this member may be bot itself) |
228
|
|
|
* |
229
|
|
|
* @var \TelegramBot\Api\Types\User |
230
|
|
|
*/ |
231
|
|
|
protected $leftChatMember; |
232
|
|
|
|
233
|
|
|
/** |
234
|
|
|
* Optional. A group title was changed to this value |
235
|
|
|
* |
236
|
|
|
* @var string |
237
|
|
|
*/ |
238
|
|
|
protected $newChatTitle; |
239
|
|
|
|
240
|
|
|
/** |
241
|
|
|
* Optional. A group photo was change to this value |
242
|
|
|
* |
243
|
|
|
* @var mixed |
244
|
|
|
*/ |
245
|
|
|
protected $newChatPhoto; |
246
|
|
|
|
247
|
|
|
/** |
248
|
|
|
* Optional. Informs that the group photo was deleted |
249
|
|
|
* |
250
|
|
|
* @var bool |
251
|
|
|
*/ |
252
|
|
|
protected $deleteChatPhoto; |
253
|
|
|
|
254
|
|
|
/** |
255
|
|
|
* Optional. Informs that the group has been created |
256
|
|
|
* |
257
|
|
|
* @var bool |
258
|
|
|
*/ |
259
|
|
|
protected $groupChatCreated; |
260
|
|
|
|
261
|
|
|
/** |
262
|
|
|
* Optional. Text description of the video (usually empty) |
263
|
|
|
* |
264
|
|
|
* @var string |
265
|
|
|
*/ |
266
|
|
|
protected $caption; |
267
|
|
|
|
268
|
|
|
|
269
|
|
|
/** |
270
|
|
|
* Optional. Service message: the supergroup has been created |
271
|
|
|
* |
272
|
|
|
* @var bool |
273
|
|
|
*/ |
274
|
|
|
protected $supergroupChatCreated; |
275
|
|
|
|
276
|
|
|
/** |
277
|
|
|
* Optional. Service message: the channel has been created |
278
|
|
|
* |
279
|
|
|
* @var bool |
280
|
|
|
*/ |
281
|
|
|
protected $channelChatCreated; |
282
|
|
|
|
283
|
|
|
/** |
284
|
|
|
* Optional. The group has been migrated to a supergroup with the specified identifier, |
285
|
|
|
* not exceeding 1e13 by absolute value |
286
|
|
|
* |
287
|
|
|
* @var int |
288
|
|
|
*/ |
289
|
|
|
protected $migrateToChatId; |
290
|
|
|
|
291
|
|
|
/** |
292
|
|
|
* Optional. The supergroup has been migrated from a group with the specified identifier, |
293
|
|
|
* not exceeding 1e13 by absolute value |
294
|
|
|
* |
295
|
|
|
* @var int |
296
|
|
|
*/ |
297
|
|
|
protected $migrateFromChatId; |
298
|
|
|
|
299
|
|
|
/** |
300
|
|
|
* Optional. Specified message was pinned.Note that the Message object in this field |
301
|
|
|
* will not contain further reply_to_message fields even if it is itself a reply. |
302
|
|
|
* |
303
|
|
|
* @var Message |
304
|
|
|
*/ |
305
|
|
|
protected $pinnedMessage; |
306
|
|
|
|
307
|
|
|
/** |
308
|
|
|
* Optional. Message is an invoice for a payment, information about the invoice. |
309
|
|
|
* |
310
|
|
|
* @var Invoice |
311
|
|
|
*/ |
312
|
|
|
protected $invoice; |
313
|
|
|
|
314
|
|
|
/** |
315
|
|
|
* Optional. Message is a service message about a successful payment, information about the payment. |
316
|
|
|
* |
317
|
|
|
* @var SuccessfulPayment |
318
|
|
|
*/ |
319
|
|
|
protected $successfulPayment; |
320
|
|
|
|
321
|
|
|
/** |
322
|
|
|
* Optional. For messages forwarded from channels, signature of the post author if present |
323
|
|
|
* |
324
|
|
|
* @var string |
325
|
|
|
*/ |
326
|
|
|
protected $forwardSignature; |
327
|
|
|
|
328
|
|
|
/** |
329
|
|
|
* Optional. Signature of the post author for messages in channels |
330
|
|
|
* |
331
|
|
|
* @var string |
332
|
|
|
*/ |
333
|
|
|
protected $authorSignature; |
334
|
|
|
|
335
|
|
|
/** |
336
|
|
|
* Optional. For messages with a caption, special entities like usernames, |
337
|
|
|
* URLs, bot commands, etc. that appear in the caption |
338
|
|
|
* |
339
|
|
|
* @var ArrayOfMessageEntity |
340
|
|
|
*/ |
341
|
|
|
protected $captionEntities; |
342
|
|
|
|
343
|
|
|
/** |
344
|
|
|
* Optional. The domain name of the website on which the user has logged in. |
345
|
|
|
* |
346
|
|
|
* @var string |
347
|
|
|
*/ |
348
|
|
|
protected $connectedWebsite; |
349
|
|
|
|
350
|
|
|
/** |
351
|
|
|
* @return string |
352
|
|
|
*/ |
353
|
1 |
|
public function getCaption() |
354
|
|
|
{ |
355
|
1 |
|
return $this->caption; |
356
|
|
|
} |
357
|
|
|
|
358
|
|
|
/** |
359
|
|
|
* @param string $caption |
360
|
|
|
*/ |
361
|
2 |
|
public function setCaption($caption) |
362
|
|
|
{ |
363
|
2 |
|
$this->caption = $caption; |
364
|
2 |
|
} |
365
|
|
|
|
366
|
|
|
/** |
367
|
|
|
* @return Audio |
368
|
|
|
*/ |
369
|
1 |
|
public function getAudio() |
370
|
|
|
{ |
371
|
1 |
|
return $this->audio; |
372
|
|
|
} |
373
|
|
|
|
374
|
|
|
/** |
375
|
|
|
* @param Audio $audio |
376
|
|
|
*/ |
377
|
2 |
|
public function setAudio(Audio $audio) |
378
|
|
|
{ |
379
|
2 |
|
$this->audio = $audio; |
380
|
2 |
|
} |
381
|
|
|
|
382
|
|
|
/** |
383
|
|
|
* @return Chat |
384
|
|
|
*/ |
385
|
2 |
|
public function getChat() |
386
|
|
|
{ |
387
|
2 |
|
return $this->chat; |
388
|
|
|
} |
389
|
|
|
|
390
|
|
|
/** |
391
|
|
|
* @param Chat $chat |
392
|
|
|
*/ |
393
|
15 |
|
public function setChat(Chat $chat) |
394
|
|
|
{ |
395
|
15 |
|
$this->chat = $chat; |
396
|
15 |
|
} |
397
|
|
|
|
398
|
|
|
/** |
399
|
|
|
* @return Contact |
400
|
|
|
*/ |
401
|
1 |
|
public function getContact() |
402
|
|
|
{ |
403
|
1 |
|
return $this->contact; |
404
|
|
|
} |
405
|
|
|
|
406
|
|
|
/** |
407
|
|
|
* @param Contact $contact |
408
|
|
|
*/ |
409
|
2 |
|
public function setContact(Contact $contact) |
410
|
|
|
{ |
411
|
2 |
|
$this->contact = $contact; |
412
|
2 |
|
} |
413
|
|
|
|
414
|
|
|
/** |
415
|
|
|
* @return int |
416
|
|
|
*/ |
417
|
1 |
|
public function getDate() |
418
|
|
|
{ |
419
|
1 |
|
return $this->date; |
420
|
|
|
} |
421
|
|
|
|
422
|
|
|
/** |
423
|
|
|
* @param int $date |
424
|
|
|
* |
425
|
|
|
* @throws InvalidArgumentException |
426
|
|
|
*/ |
427
|
14 |
|
public function setDate($date) |
428
|
|
|
{ |
429
|
14 |
|
if (is_integer($date)) { |
430
|
13 |
|
$this->date = $date; |
431
|
13 |
|
} else { |
432
|
1 |
|
throw new InvalidArgumentException(); |
433
|
|
|
} |
434
|
13 |
|
} |
435
|
|
|
|
436
|
|
|
/** |
437
|
|
|
* @return boolean |
438
|
|
|
*/ |
439
|
1 |
|
public function isDeleteChatPhoto() |
440
|
|
|
{ |
441
|
1 |
|
return $this->deleteChatPhoto; |
442
|
|
|
} |
443
|
|
|
|
444
|
|
|
/** |
445
|
|
|
* @param boolean $deleteChatPhoto |
446
|
|
|
*/ |
447
|
2 |
|
public function setDeleteChatPhoto($deleteChatPhoto) |
448
|
|
|
{ |
449
|
2 |
|
$this->deleteChatPhoto = (bool)$deleteChatPhoto; |
450
|
2 |
|
} |
451
|
|
|
|
452
|
|
|
/** |
453
|
|
|
* @return Document |
454
|
|
|
*/ |
455
|
1 |
|
public function getDocument() |
456
|
|
|
{ |
457
|
1 |
|
return $this->document; |
458
|
|
|
} |
459
|
|
|
|
460
|
|
|
/** |
461
|
|
|
* @param Document $document |
462
|
|
|
*/ |
463
|
2 |
|
public function setDocument($document) |
464
|
|
|
{ |
465
|
2 |
|
$this->document = $document; |
466
|
2 |
|
} |
467
|
|
|
|
468
|
|
|
/** |
469
|
|
|
* @return int |
470
|
|
|
*/ |
471
|
1 |
|
public function getForwardDate() |
472
|
|
|
{ |
473
|
1 |
|
return $this->forwardDate; |
474
|
|
|
} |
475
|
|
|
|
476
|
|
|
/** |
477
|
|
|
* @param int $forwardDate |
478
|
|
|
* |
479
|
|
|
* @throws InvalidArgumentException |
480
|
|
|
*/ |
481
|
3 |
|
public function setForwardDate($forwardDate) |
482
|
|
|
{ |
483
|
3 |
|
if (is_integer($forwardDate)) { |
484
|
2 |
|
$this->forwardDate = $forwardDate; |
485
|
2 |
|
} else { |
486
|
1 |
|
throw new InvalidArgumentException(); |
487
|
|
|
} |
488
|
2 |
|
} |
489
|
|
|
|
490
|
|
|
/** |
491
|
|
|
* @return User |
492
|
|
|
*/ |
493
|
1 |
|
public function getForwardFrom() |
494
|
|
|
{ |
495
|
1 |
|
return $this->forwardFrom; |
496
|
|
|
} |
497
|
|
|
|
498
|
|
|
/** |
499
|
|
|
* @param User $forwardFrom |
500
|
|
|
*/ |
501
|
2 |
|
public function setForwardFrom(User $forwardFrom) |
502
|
|
|
{ |
503
|
2 |
|
$this->forwardFrom = $forwardFrom; |
504
|
2 |
|
} |
505
|
|
|
|
506
|
|
|
/** |
507
|
|
|
* @return Chat |
508
|
|
|
*/ |
509
|
|
|
public function getForwardFromChat() |
510
|
|
|
{ |
511
|
|
|
return $this->forwardFromChat; |
512
|
|
|
} |
513
|
|
|
|
514
|
|
|
/** |
515
|
|
|
* @param Chat $forwardFromChat |
516
|
|
|
*/ |
517
|
|
|
public function setForwardFromChat(Chat $forwardFromChat) |
518
|
|
|
{ |
519
|
|
|
$this->forwardFromChat = $forwardFromChat; |
520
|
|
|
} |
521
|
|
|
|
522
|
|
|
/** |
523
|
|
|
* @return int |
524
|
|
|
*/ |
525
|
|
|
public function getForwardFromMessageId() |
526
|
|
|
{ |
527
|
|
|
return $this->forwardFromMessageId; |
528
|
|
|
} |
529
|
|
|
|
530
|
|
|
/** |
531
|
|
|
* @param int $forwardFromMessageId |
532
|
|
|
*/ |
533
|
|
|
public function setForwardFromMessageId($forwardFromMessageId) |
534
|
|
|
{ |
535
|
|
|
$this->forwardFromMessageId = $forwardFromMessageId; |
536
|
|
|
} |
537
|
|
|
|
538
|
|
|
/** |
539
|
|
|
* @return boolean |
540
|
|
|
*/ |
541
|
1 |
|
public function isGroupChatCreated() |
542
|
|
|
{ |
543
|
1 |
|
return $this->groupChatCreated; |
544
|
|
|
} |
545
|
|
|
|
546
|
|
|
/** |
547
|
|
|
* @param boolean $groupChatCreated |
548
|
|
|
*/ |
549
|
2 |
|
public function setGroupChatCreated($groupChatCreated) |
550
|
|
|
{ |
551
|
2 |
|
$this->groupChatCreated = (bool)$groupChatCreated; |
552
|
2 |
|
} |
553
|
|
|
|
554
|
|
|
/** |
555
|
|
|
* @return User |
556
|
|
|
*/ |
557
|
1 |
|
public function getLeftChatMember() |
558
|
|
|
{ |
559
|
1 |
|
return $this->leftChatMember; |
560
|
|
|
} |
561
|
|
|
|
562
|
|
|
/** |
563
|
|
|
* @param User $leftChatMember |
564
|
|
|
*/ |
565
|
2 |
|
public function setLeftChatMember($leftChatMember) |
566
|
|
|
{ |
567
|
2 |
|
$this->leftChatMember = $leftChatMember; |
568
|
2 |
|
} |
569
|
|
|
|
570
|
|
|
/** |
571
|
|
|
* @return Location |
572
|
|
|
*/ |
573
|
1 |
|
public function getLocation() |
574
|
|
|
{ |
575
|
1 |
|
return $this->location; |
576
|
|
|
} |
577
|
|
|
|
578
|
|
|
/** |
579
|
|
|
* @param Location $location |
580
|
|
|
*/ |
581
|
2 |
|
public function setLocation(Location $location) |
582
|
|
|
{ |
583
|
2 |
|
$this->location = $location; |
584
|
2 |
|
} |
585
|
|
|
|
586
|
|
|
/** |
587
|
|
|
* @return Venue |
588
|
|
|
*/ |
589
|
|
|
public function getVenue() |
590
|
|
|
{ |
591
|
|
|
return $this->venue; |
592
|
|
|
} |
593
|
|
|
|
594
|
|
|
/** |
595
|
|
|
* @param Venue $venue |
596
|
|
|
*/ |
597
|
|
|
public function setVenue($venue) |
598
|
|
|
{ |
599
|
|
|
$this->venue = $venue; |
600
|
|
|
} |
601
|
|
|
|
602
|
|
|
/** |
603
|
|
|
* @return int |
604
|
|
|
*/ |
605
|
1 |
|
public function getMessageId() |
606
|
|
|
{ |
607
|
1 |
|
return $this->messageId; |
608
|
|
|
} |
609
|
|
|
|
610
|
|
|
/** |
611
|
|
|
* @param int $messageId |
612
|
|
|
* |
613
|
|
|
* @throws InvalidArgumentException |
614
|
|
|
*/ |
615
|
15 |
|
public function setMessageId($messageId) |
616
|
|
|
{ |
617
|
15 |
|
if (is_integer($messageId) || is_float($messageId)) { |
618
|
14 |
|
$this->messageId = $messageId; |
|
|
|
|
619
|
14 |
|
} else { |
620
|
1 |
|
throw new InvalidArgumentException(); |
621
|
|
|
} |
622
|
14 |
|
} |
623
|
|
|
|
624
|
|
|
/** |
625
|
|
|
* @return User |
626
|
|
|
*/ |
627
|
1 |
|
public function getNewChatMember() |
628
|
|
|
{ |
629
|
1 |
|
return $this->newChatMember; |
630
|
|
|
} |
631
|
|
|
|
632
|
|
|
/** |
633
|
|
|
* @param User $newChatMember |
634
|
|
|
*/ |
635
|
2 |
|
public function setNewChatMember($newChatMember) |
636
|
|
|
{ |
637
|
2 |
|
$this->newChatMember = $newChatMember; |
638
|
2 |
|
} |
639
|
|
|
|
640
|
|
|
/** |
641
|
|
|
* @return array |
642
|
|
|
*/ |
643
|
1 |
|
public function getNewChatPhoto() |
644
|
|
|
{ |
645
|
1 |
|
return $this->newChatPhoto; |
646
|
|
|
} |
647
|
|
|
|
648
|
|
|
/** |
649
|
|
|
* @param array $newChatPhoto |
650
|
|
|
*/ |
651
|
2 |
|
public function setNewChatPhoto($newChatPhoto) |
652
|
|
|
{ |
653
|
2 |
|
$this->newChatPhoto = $newChatPhoto; |
654
|
2 |
|
} |
655
|
|
|
|
656
|
|
|
/** |
657
|
|
|
* @return string |
658
|
|
|
*/ |
659
|
1 |
|
public function getNewChatTitle() |
660
|
|
|
{ |
661
|
1 |
|
return $this->newChatTitle; |
662
|
|
|
} |
663
|
|
|
|
664
|
|
|
/** |
665
|
|
|
* @param string $newChatTitle |
666
|
|
|
*/ |
667
|
2 |
|
public function setNewChatTitle($newChatTitle) |
668
|
|
|
{ |
669
|
2 |
|
$this->newChatTitle = $newChatTitle; |
670
|
2 |
|
} |
671
|
|
|
|
672
|
|
|
/** |
673
|
|
|
* @return array |
674
|
|
|
*/ |
675
|
1 |
|
public function getPhoto() |
676
|
|
|
{ |
677
|
1 |
|
return $this->photo; |
678
|
|
|
} |
679
|
|
|
|
680
|
|
|
/** |
681
|
|
|
* @param array $photo |
682
|
|
|
*/ |
683
|
2 |
|
public function setPhoto(array $photo) |
684
|
|
|
{ |
685
|
2 |
|
$this->photo = $photo; |
686
|
2 |
|
} |
687
|
|
|
|
688
|
|
|
/** |
689
|
|
|
* @return int |
690
|
|
|
*/ |
691
|
|
|
public function getMediaGroupId() |
692
|
|
|
{ |
693
|
|
|
return $this->mediaGroupId; |
694
|
|
|
} |
695
|
|
|
|
696
|
|
|
/** |
697
|
|
|
* @param int $mediaGroupId |
698
|
|
|
*/ |
699
|
|
|
public function setMediaGroupId($mediaGroupId) |
700
|
|
|
{ |
701
|
|
|
$this->mediaGroupId = $mediaGroupId; |
702
|
|
|
} |
703
|
|
|
|
704
|
|
|
/** |
705
|
|
|
* @return Message |
706
|
|
|
*/ |
707
|
1 |
|
public function getReplyToMessage() |
708
|
|
|
{ |
709
|
1 |
|
return $this->replyToMessage; |
710
|
|
|
} |
711
|
|
|
|
712
|
|
|
/** |
713
|
|
|
* @param Message $replyToMessage |
714
|
|
|
*/ |
715
|
2 |
|
public function setReplyToMessage(Message $replyToMessage) |
716
|
|
|
{ |
717
|
2 |
|
$this->replyToMessage = $replyToMessage; |
718
|
2 |
|
} |
719
|
|
|
|
720
|
|
|
/** |
721
|
|
|
* @return Sticker |
722
|
|
|
*/ |
723
|
1 |
|
public function getSticker() |
724
|
|
|
{ |
725
|
1 |
|
return $this->sticker; |
726
|
|
|
} |
727
|
|
|
|
728
|
|
|
/** |
729
|
|
|
* @param Sticker $sticker |
730
|
|
|
*/ |
731
|
2 |
|
public function setSticker(Sticker $sticker) |
732
|
|
|
{ |
733
|
2 |
|
$this->sticker = $sticker; |
734
|
2 |
|
} |
735
|
|
|
|
736
|
|
|
/** |
737
|
|
|
* @return string |
738
|
|
|
*/ |
739
|
7 |
|
public function getText() |
740
|
|
|
{ |
741
|
7 |
|
return $this->text; |
742
|
|
|
} |
743
|
|
|
|
744
|
|
|
/** |
745
|
|
|
* @param string $text |
746
|
|
|
*/ |
747
|
5 |
|
public function setText($text) |
748
|
|
|
{ |
749
|
5 |
|
$this->text = $text; |
750
|
5 |
|
} |
751
|
|
|
|
752
|
|
|
/** |
753
|
|
|
* @return array |
754
|
|
|
*/ |
755
|
|
|
public function getEntities() |
756
|
|
|
{ |
757
|
|
|
return $this->entities; |
758
|
|
|
} |
759
|
|
|
|
760
|
|
|
/** |
761
|
|
|
* @param array $entities |
762
|
|
|
*/ |
763
|
1 |
|
public function setEntities($entities) |
764
|
|
|
{ |
765
|
1 |
|
$this->entities = $entities; |
766
|
1 |
|
} |
767
|
|
|
|
768
|
|
|
/** |
769
|
|
|
* @return User |
770
|
|
|
*/ |
771
|
1 |
|
public function getFrom() |
772
|
|
|
{ |
773
|
1 |
|
return $this->from; |
774
|
|
|
} |
775
|
|
|
|
776
|
|
|
/** |
777
|
|
|
* @param User $from |
778
|
|
|
*/ |
779
|
13 |
|
public function setFrom(User $from) |
780
|
|
|
{ |
781
|
13 |
|
$this->from = $from; |
782
|
13 |
|
} |
783
|
|
|
|
784
|
|
|
/** |
785
|
|
|
* @return Video |
786
|
|
|
*/ |
787
|
1 |
|
public function getVideo() |
788
|
|
|
{ |
789
|
1 |
|
return $this->video; |
790
|
|
|
} |
791
|
|
|
|
792
|
|
|
/** |
793
|
|
|
* @param Video $video |
794
|
|
|
*/ |
795
|
2 |
|
public function setVideo(Video $video) |
796
|
|
|
{ |
797
|
2 |
|
$this->video = $video; |
798
|
2 |
|
} |
799
|
|
|
|
800
|
|
|
/** |
801
|
|
|
* @return Voice |
802
|
|
|
*/ |
803
|
1 |
|
public function getVoice() |
804
|
|
|
{ |
805
|
1 |
|
return $this->voice; |
806
|
|
|
} |
807
|
|
|
|
808
|
|
|
/** |
809
|
|
|
* @param Voice $voice |
810
|
|
|
*/ |
811
|
2 |
|
public function setVoice($voice) |
812
|
|
|
{ |
813
|
2 |
|
$this->voice = $voice; |
814
|
2 |
|
} |
815
|
|
|
|
816
|
|
|
/** |
817
|
|
|
* @param boolean $supergroupChatCreated |
818
|
|
|
*/ |
819
|
2 |
|
public function setSupergroupChatCreated($supergroupChatCreated) |
820
|
|
|
{ |
821
|
2 |
|
$this->supergroupChatCreated = $supergroupChatCreated; |
822
|
2 |
|
} |
823
|
|
|
|
824
|
|
|
/** |
825
|
|
|
* @return boolean |
826
|
|
|
*/ |
827
|
1 |
|
public function isSupergroupChatCreated() |
828
|
|
|
{ |
829
|
1 |
|
return $this->supergroupChatCreated; |
830
|
|
|
} |
831
|
|
|
|
832
|
|
|
/** |
833
|
|
|
* @param boolean $channelChatCreated |
834
|
|
|
*/ |
835
|
2 |
|
public function setChannelChatCreated($channelChatCreated) |
836
|
|
|
{ |
837
|
2 |
|
$this->channelChatCreated = $channelChatCreated; |
838
|
2 |
|
} |
839
|
|
|
|
840
|
|
|
/** |
841
|
|
|
* @return boolean |
842
|
|
|
*/ |
843
|
1 |
|
public function isChannelChatCreated() |
844
|
|
|
{ |
845
|
1 |
|
return $this->channelChatCreated; |
846
|
|
|
} |
847
|
|
|
|
848
|
|
|
/** |
849
|
|
|
* @param int $migrateToChatId |
850
|
|
|
*/ |
851
|
2 |
|
public function setMigrateToChatId($migrateToChatId) |
852
|
|
|
{ |
853
|
2 |
|
$this->migrateToChatId = $migrateToChatId; |
854
|
2 |
|
} |
855
|
|
|
|
856
|
|
|
/** |
857
|
|
|
* @return int |
858
|
|
|
*/ |
859
|
1 |
|
public function getMigrateToChatId() |
860
|
|
|
{ |
861
|
1 |
|
return $this->migrateToChatId; |
862
|
|
|
} |
863
|
|
|
|
864
|
|
|
/** |
865
|
|
|
* @param int $migrateFromChatId |
866
|
|
|
*/ |
867
|
4 |
|
public function setMigrateFromChatId($migrateFromChatId) |
868
|
|
|
{ |
869
|
4 |
|
$this->migrateFromChatId = $migrateFromChatId; |
870
|
4 |
|
} |
871
|
|
|
|
872
|
|
|
/** |
873
|
|
|
* @return int |
874
|
|
|
*/ |
875
|
1 |
|
public function getMigrateFromChatId() |
876
|
|
|
{ |
877
|
1 |
|
return $this->migrateFromChatId; |
878
|
|
|
} |
879
|
|
|
|
880
|
|
|
/** |
881
|
|
|
* @return Message |
882
|
|
|
*/ |
883
|
|
|
public function getPinnedMessage() |
884
|
|
|
{ |
885
|
|
|
return $this->pinnedMessage; |
886
|
|
|
} |
887
|
|
|
|
888
|
|
|
/** |
889
|
|
|
* @param Message $pinnedMessage |
890
|
|
|
*/ |
891
|
|
|
public function setPinnedMessage($pinnedMessage) |
892
|
|
|
{ |
893
|
|
|
$this->pinnedMessage = $pinnedMessage; |
894
|
|
|
} |
895
|
|
|
|
896
|
|
|
/** |
897
|
|
|
* @author MY |
898
|
|
|
* @return Invoice |
899
|
|
|
*/ |
900
|
|
|
public function getInvoice() |
901
|
|
|
{ |
902
|
|
|
return $this->invoice; |
903
|
|
|
} |
904
|
|
|
|
905
|
|
|
/** |
906
|
|
|
* @author MY |
907
|
|
|
* @param Invoice $invoice |
908
|
|
|
*/ |
909
|
|
|
public function setInvoice($invoice) |
910
|
|
|
{ |
911
|
|
|
$this->invoice = $invoice; |
912
|
|
|
} |
913
|
|
|
|
914
|
|
|
/** |
915
|
|
|
* @author MY |
916
|
|
|
* @return SuccessfulPayment |
917
|
|
|
*/ |
918
|
|
|
public function getSuccessfulPayment() |
919
|
|
|
{ |
920
|
|
|
return $this->successfulPayment; |
921
|
|
|
} |
922
|
|
|
|
923
|
|
|
/** |
924
|
|
|
* @author MY |
925
|
|
|
* @param SuccessfulPayment $successfulPayment |
926
|
|
|
*/ |
927
|
|
|
public function setSuccessfulPayment($successfulPayment) |
928
|
|
|
{ |
929
|
|
|
$this->successfulPayment = $successfulPayment; |
930
|
|
|
} |
931
|
|
|
|
932
|
|
|
/** |
933
|
|
|
* @return string |
934
|
|
|
*/ |
935
|
|
|
public function getForwardSignature() |
936
|
|
|
{ |
937
|
|
|
return $this->forwardSignature; |
938
|
|
|
} |
939
|
|
|
|
940
|
|
|
/** |
941
|
|
|
* @param string $forwardSignature |
942
|
|
|
*/ |
943
|
|
|
public function setForwardSignature($forwardSignature) |
944
|
|
|
{ |
945
|
|
|
$this->forwardSignature = $forwardSignature; |
946
|
|
|
} |
947
|
|
|
|
948
|
|
|
/** |
949
|
|
|
* @return string |
950
|
|
|
*/ |
951
|
|
|
public function getAuthorSignature() |
952
|
|
|
{ |
953
|
|
|
return $this->authorSignature; |
954
|
|
|
} |
955
|
|
|
|
956
|
|
|
/** |
957
|
|
|
* @param string $authorSignature |
958
|
|
|
*/ |
959
|
|
|
public function setAuthorSignature($authorSignature) |
960
|
|
|
{ |
961
|
|
|
$this->authorSignature = $authorSignature; |
962
|
|
|
} |
963
|
|
|
|
964
|
|
|
/** |
965
|
|
|
* @return ArrayOfMessageEntity |
966
|
|
|
*/ |
967
|
|
|
public function getCaptionEntities() |
968
|
|
|
{ |
969
|
|
|
return $this->captionEntities; |
970
|
|
|
} |
971
|
|
|
|
972
|
|
|
/** |
973
|
|
|
* @param ArrayOfMessageEntity $captionEntities |
974
|
|
|
*/ |
975
|
|
|
public function setCaptionEntities($captionEntities) |
976
|
|
|
{ |
977
|
|
|
$this->captionEntities = $captionEntities; |
978
|
|
|
} |
979
|
|
|
|
980
|
|
|
/** |
981
|
|
|
* @return string |
982
|
|
|
*/ |
983
|
|
|
public function getConnectedWebsite() |
984
|
|
|
{ |
985
|
|
|
return $this->connectedWebsite; |
986
|
|
|
} |
987
|
|
|
|
988
|
|
|
/** |
989
|
|
|
* @param string $connectedWebsite |
990
|
|
|
*/ |
991
|
|
|
public function setConnectedWebsite($connectedWebsite) |
992
|
|
|
{ |
993
|
|
|
$this->connectedWebsite = $connectedWebsite; |
994
|
|
|
} |
995
|
|
|
} |
996
|
|
|
|
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.