Completed
Push — master ( ff2211...84868c )
by Gusev
03:53 queued 01:00
created

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