Completed
Push — master ( a762f2...2457f1 )
by Gusev
02:22
created

Message::getMigrateToChatId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
namespace TelegramBot\Api\Types;
3
4
use TelegramBot\Api\BaseType;
5
use TelegramBot\Api\InvalidArgumentException;
6
use TelegramBot\Api\TypeInterface;
7
8
class Message extends BaseType implements TypeInterface
9
{
10
    /**
11
     * {@inheritdoc}
12
     *
13
     * @var array
14
     */
15
    static protected $requiredParams = ['message_id', 'from', 'date', 'chat'];
16
17
    /**
18
     * {@inheritdoc}
19
     *
20
     * @var array
21
     */
22
    static protected $map = [
23
        'message_id' => true,
24
        'from' => User::class,
25
        'date' => true,
26
        'chat' => Chat::class,
27
        'forward_from' => User::class,
28
        'forward_date' => true,
29
        'reply_to_message' => Message::class,
30
        'text' => true,
31
        'audio' => Audio::class,
32
        'document' => Document::class,
33
        'photo' => ArrayOfPhotoSize::class,
34
        'sticker' => Sticker::class,
35
        'video' => Video::class,
36
        'voice' => Voice::class,
37
        'caption' => true,
38
        'contact' => Contact::class,
39
        'location' => Location::class,
40
        'new_chat_participant' => User::class,
41
        'left_chat_participant' => User::class,
42
        'new_chat_title' => true,
43
        'new_chat_photo' => ArrayOfPhotoSize::class,
44
        'delete_chat_photo' => true,
45
        'group_chat_created' => true,
46
        'supergroup_chat_created' => true,
47
        'channel_chat_created' => true,
48
        'migrate_to_chat_id' => true,
49
        'migrate_from_chat_id' => true,
50
    ];
51
52
    /**
53
     * Unique message identifier
54
     *
55
     * @var int
56
     */
57
    protected $messageId;
58
59
    /**
60
     * Sender
61
     *
62
     * @var \TelegramBot\Api\Types\User
63
     */
64
    protected $from;
65
66
    /**
67
     * Date the message was sent in Unix time
68
     *
69
     * @var int
70
     */
71
    protected $date;
72
73
    /**
74
     * Conversation the message belongs to — user in case of a private message, GroupChat in case of a group
75
     *
76
     * @var \TelegramBot\Api\Types\Chat
77
     */
78
    protected $chat;
79
80
    /**
81
     * Optional. For forwarded messages, sender of the original message
82
     *
83
     * @var \TelegramBot\Api\Types\User
84
     */
85
    protected $forwardFrom;
86
87
    /**
88
     * Optional. For forwarded messages, date the original message was sent in Unix time
89
     *
90
     * @var int
91
     */
92
    protected $forwardDate;
93
94
    /**
95
     * Optional. For replies, the original message. Note that the Message object in this field will not contain further
96
     * reply_to_message fields even if it itself is a reply.
97
     *
98
     * @var \TelegramBot\Api\Types\Message
99
     */
100
    protected $replyToMessage;
101
102
    /**
103
     * Optional. For text messages, the actual UTF-8 text of the message
104
     *
105
     * @var string
106
     */
107
    protected $text;
108
109
    /**
110
     * Optional. Message is an audio file, information about the file
111
     *
112
     * @var \TelegramBot\Api\Types\Audio
113
     */
114
    protected $audio;
115
116
    /**
117
     * Optional. Message is a general file, information about the file
118
     *
119
     * @var \TelegramBot\Api\Types\Document
120
     */
121
    protected $document;
122
123
    /**
124
     * Optional. Message is a photo, available sizes of the photo
125
     * array of \TelegramBot\Api\Types\Photo
126
     *
127
     * @var array
128
     */
129
    protected $photo;
130
131
    /**
132
     * Optional. Message is a sticker, information about the sticker
133
     *
134
     * @var \TelegramBot\Api\Types\Sticker
135
     */
136
    protected $sticker;
137
138
    /**
139
     * Optional. Message is a video, information about the video
140
     *
141
     * @var \TelegramBot\Api\Types\Video
142
     */
143
    protected $video;
144
145
    /**
146
     * Optional. Message is a voice message, information about the file
147
     *
148
     * @var \TelegramBot\Api\Types\Voice
149
     */
150
    protected $voice;
151
152
    /**
153
     * Optional. Message is a shared contact, information about the contact
154
     *
155
     * @var \TelegramBot\Api\Types\Contact
156
     */
157
    protected $contact;
158
159
    /**
160
     * Optional. Message is a shared location, information about the location
161
     *
162
     * @var \TelegramBot\Api\Types\Location
163
     */
164
    protected $location;
165
166
    /**
167
     * Optional. A new member was added to the group, information about them (this member may be bot itself)
168
     *
169
     * @var \TelegramBot\Api\Types\User
170
     */
171
    protected $newChatParticipant;
172
173
    /**
174
     * Optional. A member was removed from the group, information about them (this member may be bot itself)
175
     *
176
     * @var \TelegramBot\Api\Types\User
177
     */
178
    protected $leftChatParticipant;
179
180
    /**
181
     * Optional. A group title was changed to this value
182
     *
183
     * @var string
184
     */
185
    protected $newChatTitle;
186
187
    /**
188
     * Optional. A group photo was change to this value
189
     *
190
     * @var mixed
191
     */
192
    protected $newChatPhoto;
193
194
    /**
195
     * Optional. Informs that the group photo was deleted
196
     *
197
     * @var bool
198
     */
199
    protected $deleteChatPhoto;
200
201
    /**
202
     * Optional. Informs that the group has been created
203
     *
204
     * @var bool
205
     */
206
    protected $groupChatCreated;
207
208
    /**
209
     * Optional. Text description of the video (usually empty)
210
     *
211
     * @var string
212
     */
213
    protected $caption;
214
215
216
    /**
217
     * Optional. Service message: the supergroup has been created
218
     *
219
     * @var bool
220
     */
221
    protected $supergroupChatCreated;
222
223
    /**
224
     * Optional. Service message: the channel has been created
225
     *
226
     * @var bool
227
     */
228
    protected $channelChatCreated;
229
230
    /**
231
     * Optional. The group has been migrated to a supergroup with the specified identifier,
232
     * not exceeding 1e13 by absolute value
233
     *
234
     * @var int
235
     */
236
    protected $migrateToChatId;
237
238
    /**
239
     * Optional. The supergroup has been migrated from a group with the specified identifier,
240
     * not exceeding 1e13 by absolute value
241
     *
242
     * @var int
243
     */
244
    protected $migrateFromChatId;
245
246
    /**
247
     * @return string
248
     */
249 3
    public function getCaption()
250
    {
251 3
        return $this->caption;
252
    }
253
254
    /**
255
     * @param string $caption
256
     */
257 6
    public function setCaption($caption)
258
    {
259 6
        $this->caption = $caption;
260 6
    }
261
262
    /**
263
     * @return Audio
264
     */
265 3
    public function getAudio()
266
    {
267 3
        return $this->audio;
268
    }
269
270
    /**
271
     * @param Audio $audio
272
     */
273 6
    public function setAudio(Audio $audio)
274
    {
275 6
        $this->audio = $audio;
276 6
    }
277
278
    /**
279
     * @return TypeInterface
280
     */
281 6
    public function getChat()
282
    {
283 6
        return $this->chat;
284
    }
285
286
    /**
287
     * @param Chat $chat
288
     */
289 18
    public function setChat(Chat $chat)
290
    {
291 18
        $this->chat = $chat;
292 18
    }
293
294
    /**
295
     * @return Contact
296
     */
297 3
    public function getContact()
298
    {
299 3
        return $this->contact;
300
    }
301
302
    /**
303
     * @param Contact $contact
304
     */
305 6
    public function setContact(Contact $contact)
306
    {
307 6
        $this->contact = $contact;
308 6
    }
309
310
    /**
311
     * @return int
312
     */
313 3
    public function getDate()
314
    {
315 3
        return $this->date;
316
    }
317
318
    /**
319
     * @param int $date
320
     *
321
     * @throws InvalidArgumentException
322
     */
323 15
    public function setDate($date)
324
    {
325 15
        if (is_integer($date)) {
326 12
            $this->date = $date;
327 12
        } else {
328 3
            throw new InvalidArgumentException();
329
        }
330 12
    }
331
332
    /**
333
     * @return boolean
334
     */
335 3
    public function isDeleteChatPhoto()
336
    {
337 3
        return $this->deleteChatPhoto;
338
    }
339
340
    /**
341
     * @param boolean $deleteChatPhoto
342
     */
343 6
    public function setDeleteChatPhoto($deleteChatPhoto)
344
    {
345 6
        $this->deleteChatPhoto = (bool)$deleteChatPhoto;
346 6
    }
347
348
    /**
349
     * @return Document
350
     */
351 3
    public function getDocument()
352
    {
353 3
        return $this->document;
354
    }
355
356
    /**
357
     * @param Document $document
358
     */
359 6
    public function setDocument($document)
360
    {
361 6
        $this->document = $document;
362 6
    }
363
364
    /**
365
     * @return int
366
     */
367 3
    public function getForwardDate()
368
    {
369 3
        return $this->forwardDate;
370
    }
371
372
    /**
373
     * @param int $forwardDate
374
     *
375
     * @throws InvalidArgumentException
376
     */
377 9
    public function setForwardDate($forwardDate)
378
    {
379 9
        if (is_integer($forwardDate)) {
380 6
            $this->forwardDate = $forwardDate;
381 6
        } else {
382 3
            throw new InvalidArgumentException();
383
        }
384 6
    }
385
386
    /**
387
     * @return User
388
     */
389 3
    public function getForwardFrom()
390
    {
391 3
        return $this->forwardFrom;
392
    }
393
394
    /**
395
     * @param User $forwardFrom
396
     */
397 6
    public function setForwardFrom(User $forwardFrom)
398
    {
399 6
        $this->forwardFrom = $forwardFrom;
400 6
    }
401
402
    /**
403
     * @return boolean
404
     */
405 3
    public function isGroupChatCreated()
406
    {
407 3
        return $this->groupChatCreated;
408
    }
409
410
    /**
411
     * @param boolean $groupChatCreated
412
     */
413 6
    public function setGroupChatCreated($groupChatCreated)
414
    {
415 6
        $this->groupChatCreated = (bool)$groupChatCreated;
416 6
    }
417
418
    /**
419
     * @return User
420
     */
421 3
    public function getLeftChatParticipant()
422
    {
423 3
        return $this->leftChatParticipant;
424
    }
425
426
    /**
427
     * @param User $leftChatParticipant
428
     */
429 6
    public function setLeftChatParticipant($leftChatParticipant)
430
    {
431 6
        $this->leftChatParticipant = $leftChatParticipant;
432 6
    }
433
434
    /**
435
     * @return Location
436
     */
437 3
    public function getLocation()
438
    {
439 3
        return $this->location;
440
    }
441
442
    /**
443
     * @param Location $location
444
     */
445 6
    public function setLocation(Location $location)
446
    {
447 6
        $this->location = $location;
448 6
    }
449
450
    /**
451
     * @return int
452
     */
453 3
    public function getMessageId()
454
    {
455 3
        return $this->messageId;
456
    }
457
458
    /**
459
     * @param int $messageId
460
     *
461
     * @throws InvalidArgumentException
462
     */
463 15
    public function setMessageId($messageId)
464
    {
465 15
        if (is_integer($messageId)) {
466 12
            $this->messageId = $messageId;
467 12
        } else {
468 3
            throw new InvalidArgumentException();
469
        }
470 12
    }
471
472
    /**
473
     * @return User
474
     */
475 3
    public function getNewChatParticipant()
476
    {
477 3
        return $this->newChatParticipant;
478
    }
479
480
    /**
481
     * @param User $newChatParticipant
482
     */
483 6
    public function setNewChatParticipant($newChatParticipant)
484
    {
485 6
        $this->newChatParticipant = $newChatParticipant;
486 6
    }
487
488
    /**
489
     * @return array
490
     */
491 3
    public function getNewChatPhoto()
492
    {
493 3
        return $this->newChatPhoto;
494
    }
495
496
    /**
497
     * @param array $newChatPhoto
498
     */
499 6
    public function setNewChatPhoto($newChatPhoto)
500
    {
501 6
        $this->newChatPhoto = $newChatPhoto;
502 6
    }
503
504
    /**
505
     * @return string
506
     */
507 3
    public function getNewChatTitle()
508
    {
509 3
        return $this->newChatTitle;
510
    }
511
512
    /**
513
     * @param string $newChatTitle
514
     */
515 6
    public function setNewChatTitle($newChatTitle)
516
    {
517 6
        $this->newChatTitle = $newChatTitle;
518 6
    }
519
520
    /**
521
     * @return array
522
     */
523 3
    public function getPhoto()
524
    {
525 3
        return $this->photo;
526
    }
527
528
    /**
529
     * @param array $photo
530
     */
531 6
    public function setPhoto(array $photo)
532
    {
533 6
        $this->photo = $photo;
534 6
    }
535
536
    /**
537
     * @return Message
538
     */
539 3
    public function getReplyToMessage()
540
    {
541 3
        return $this->replyToMessage;
542
    }
543
544
    /**
545
     * @param Message $replyToMessage
546
     */
547 6
    public function setReplyToMessage(Message $replyToMessage)
548
    {
549 6
        $this->replyToMessage = $replyToMessage;
550 6
    }
551
552
    /**
553
     * @return Sticker
554
     */
555 3
    public function getSticker()
556
    {
557 3
        return $this->sticker;
558
    }
559
560
    /**
561
     * @param Sticker $sticker
562
     */
563 6
    public function setSticker(Sticker $sticker)
564
    {
565 6
        $this->sticker = $sticker;
566 6
    }
567
568
    /**
569
     * @return string
570
     */
571 3
    public function getText()
572
    {
573 3
        return $this->text;
574
    }
575
576
    /**
577
     * @param string $text
578
     */
579 6
    public function setText($text)
580
    {
581 6
        $this->text = $text;
582 6
    }
583
584
    /**
585
     * @return User
586
     */
587 3
    public function getFrom()
588
    {
589 3
        return $this->from;
590
    }
591
592
    /**
593
     * @param User $from
594
     */
595 12
    public function setFrom(User $from)
596
    {
597 12
        $this->from = $from;
598 12
    }
599
600
    /**
601
     * @return Video
602
     */
603 3
    public function getVideo()
604
    {
605 3
        return $this->video;
606
    }
607
608
    /**
609
     * @param Video $video
610
     */
611 6
    public function setVideo(Video $video)
612
    {
613 6
        $this->video = $video;
614 6
    }
615
616
    /**
617
     * @return Voice
618
     */
619 3
    public function getVoice()
620
    {
621 3
        return $this->voice;
622
    }
623
624
    /**
625
     * @param Voice $voice
626
     */
627 6
    public function setVoice($voice)
628
    {
629 6
        $this->voice = $voice;
630 6
    }
631
632
    /**
633
     * @param boolean $supergroupChatCreated
634
     */
635
    public function setSupergroupChatCreated($supergroupChatCreated)
636
    {
637
        $this->supergroupChatCreated = $supergroupChatCreated;
638
    }
639
640
    /**
641
     * @return boolean
642
     */
643
    public function isSupergroupChatCreated()
644
    {
645
        return $this->supergroupChatCreated;
646
    }
647
648
    /**
649
     * @param boolean $channelChatCreated
650
     */
651
    public function setChannelChatCreated($channelChatCreated)
652
    {
653
        $this->channelChatCreated = $channelChatCreated;
654
    }
655
656
    /**
657
     * @return boolean
658
     */
659
    public function isChannelChatCreated()
660
    {
661
        return $this->channelChatCreated;
662
    }
663
664
    /**
665
     * @param int $migrateToChatId
666
     */
667
    public function setMigrateToChatId($migrateToChatId)
668
    {
669
        $this->migrateToChatId = $migrateToChatId;
670
    }
671
672
    /**
673
     * @return int
674
     */
675
    public function getMigrateToChatId()
676
    {
677
        return $this->migrateToChatId;
678
    }
679
680
    /**
681
     * @param int $migrateFromChatId
682
     */
683
    public function setMigrateFromChatId($migrateFromChatId)
684
    {
685
        $this->migrateFromChatId = $migrateFromChatId;
686
    }
687
688
    /**
689
     * @return int
690
     */
691
    public function getMigrateFromChatId()
692
    {
693
        return $this->migrateFromChatId;
694
    }
695
}
696