Chat::setLastName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 0
cts 0
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace TelegramBot\Api\Types;
4
5
use TelegramBot\Api\BaseType;
6
use TelegramBot\Api\InvalidArgumentException;
7
use TelegramBot\Api\TypeInterface;
8
9
class Chat extends BaseType implements TypeInterface
10
{
11
    /**
12
     * {@inheritdoc}
13
     *
14
     * @var array
15
     */
16
    protected static $requiredParams = ['id', 'type'];
17
18
    /**
19
     * {@inheritdoc}
20
     *
21
     * @var array
22
     */
23
    protected static $map = [
24
        'id' => true,
25
        'type' => true,
26
        'title' => true,
27
        'username' => true,
28
        'first_name' => true,
29
        'last_name' => true,
30
        'photo' => ChatPhoto::class,
31
        'bio' => true,
32
        'description' => true,
33
        'invite_link' => true,
34
        'pinned_message' => Message::class,
35
        'permissions' => ChatPermissions::class,
36
        'slow_mode_delay' => true,
37
        'sticker_set_name' => true,
38
        'can_set_sticker_set' => true,
39
        'linked_chat_id' => true,
40
        'location' => ChatLocation::class,
41
        'join_to_send_messages' => true,
42
        'join_by_request' => true,
43
        'message_auto_delete_time' => true,
44
        'has_protected_content' => true,
45
        'is_forum' => true,
46
        'active_usernames' => true,
47
        'emoji_status_custom_emoji_id' => true,
48
        'has_private_forwards' => true,
49
        'has_restricted_voice_and_video_messages' => true,
50
    ];
51
52
    /**
53
     * Unique identifier for this chat, not exceeding 1e13 by absolute value
54
     *
55
     * @var int|float|string
56
     */
57
    protected $id;
58
59
    /**
60
     * Type of chat, can be either “private”, “group”, “supergroup” or “channel”
61
     *
62
     * @var string
63
     */
64
    protected $type;
65
66
    /**
67
     * Optional. Title, for channels and group chats
68
     *
69
     * @var string|null
70
     */
71
    protected $title;
72
73
    /**
74
     * Optional. Username, for private chats and channels if available
75
     *
76
     * @var string|null
77
     */
78
    protected $username;
79
80
    /**
81
     * Optional. First name of the other party in a private chat
82
     *
83
     * @var string|null
84
     */
85
    protected $firstName;
86
87
    /**
88
     * Optional. Last name of the other party in a private chat
89
     *
90
     * @var string|null
91
     */
92
    protected $lastName;
93
94
    /**
95
     * Optional. Chat photo. Returned only in getChat.
96
     *
97
     * @var ChatPhoto|null
98
     */
99
    protected $photo;
100
101
    /**
102
     * Optional. Bio of the other party in a private chat. Returned only in getChat
103
     *
104
     * @var string|null
105
     */
106
    protected $bio;
107
108
    /**
109
     * Optional. Description, for supergroups and channel chats. Returned only in getChat.
110
     *
111
     * @var string|null
112
     */
113
    protected $description;
114
115
    /**
116
     * Optional. Chat invite link, for supergroups and channel chats. Returned only in getChat.
117
     *
118
     * @var string|null
119
     */
120
    protected $inviteLink;
121
122
    /**
123
     * Optional. Pinned message, for supergroups. Returned only in getChat.
124
     *
125
     * @var Message|null
126
     */
127
    protected $pinnedMessage;
128
129
    /**
130
     * Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat.
131
     *
132
     * @var ChatPermissions|null
133
     */
134
    protected $permissions;
135
136
    /**
137
     * Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged
138
     * user. Returned only in getChat.
139
     *
140
     * @var int|null
141
     */
142
    protected $slowModeDelay;
143
144
    /**
145
     * Optional. For supergroups, name of group sticker set. Returned only in getChat.
146
     *
147
     * @var string|null
148
     */
149
    protected $stickerSetName;
150
151
    /**
152
     * Optional. True, if the bot can change the group sticker set. Returned only in getChat.
153
     *
154
     * @var bool|null
155
     */
156
    protected $canSetStickerSet;
157
158
    /**
159
     * Optional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice
160
     * versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming
161
     * languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64
162
     * bit integer or double-precision float type are safe for storing this identifier. Returned only in getChat.
163
     *
164
     * @var int|null
165
     */
166
    protected $linkedChatId;
167
168
    /**
169
     * Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat.
170
     *
171
     * @var ChatLocation|null
172
     */
173
    protected $location;
174
175
    /**
176
     * Optional. True, if users need to join the supergroup before they can send messages. Returned only in getChat.
177
     *
178
     * @var bool|null
179
     */
180
    protected $joinToSendMessages;
181
182
    /**
183
     * Optional. True, if all users directly joining the supergroup need to be approved by supergroup administrators. Returned only in getChat.
184
     *
185
     * @var bool|null
186
     */
187
    protected $joinByRequest;
188
189
    /**
190
     * Optional. Time after which all messages sent to the chat will be automatically deleted; in seconds. Returned
191
     * only in getChat.
192
     *
193
     * @var int|null
194
     */
195
    protected $messageAutoDeleteTime;
196
197
    /**
198
     * 	Optional. True, if messages from the chat can't be forwarded to other chats. Returned only in getChat.
199
     *
200
     * @var bool|null
201
     */
202
    protected $hasProtectedContent;
203
204
    /**
205
     * Optional. True, if the supergroup chat is a forum (has topics enabled)
206
     *
207
     * @var bool|null
208
     */
209
    protected $isForum;
210
211
    /**
212
     * Optional. If non-empty, the list of all active chat usernames;
213
     * for private chats, supergroups and channels. Returned only in getChat.
214
     *
215
     * @var array[]|null
216
     */
217
    protected $activeUsernames;
218
219
    /**
220
     * Optional. Custom emoji identifier of emoji status of the other party in a private chat. Returned only in getChat.
221
     *
222
     * @var string|null
223
     */
224
    protected $emojiStatusCustomEmojiId;
225
226
    /**
227
     * Optional. True, if privacy settings of the other party in the private chat allows
228
     * to use tg://user?id=<user_id> links only in chats with the user.
229
     * Returned only in getChat.
230
     *
231
     * @var bool|null
232
     */
233
    protected $hasPrivateForwards;
234
235
    /**
236
     * Optional. True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat.
237
     * Returned only in getChat.
238
     *
239
     * @var bool|null
240
     */
241
    protected $hasRestrictedVoiceAndVideoMessages;
242
243
    /**
244
     * @return int|float|string
245
     */
246 3
    public function getId()
247
    {
248 3
        return $this->id;
249
    }
250
251
    /**
252
     * @param mixed $id
253
     * @return void
254
     * @throws InvalidArgumentException
255
     */
256 23
    public function setId($id)
257
    {
258 23
        if (is_integer($id) || is_float($id) || is_string($id)) {
259 21
            $this->id = $id;
260 21
        } else {
261 2
            throw new InvalidArgumentException();
262
        }
263 21
    }
264
265
    /**
266
     * @return string
267
     */
268 1
    public function getType()
269
    {
270 1
        return $this->type;
271
    }
272
273
    /**
274
     * @param string $type
275
     * @return void
276 20
     */
277
    public function setType($type)
278 20
    {
279 20
        $this->type = $type;
280
    }
281
282
    /**
283
     * @return null|string
284 2
     */
285
    public function getTitle()
286 2
    {
287
        return $this->title;
288
    }
289
290
    /**
291
     * @param string $title
292 14
     * @return void
293
     */
294 14
    public function setTitle($title)
295 14
    {
296
        $this->title = $title;
297
    }
298
299
    /**
300 2
     * @return null|string
301
     */
302 2
    public function getUsername()
303
    {
304
        return $this->username;
305
    }
306
307
    /**
308 8
     * @param string $username
309
     * @return void
310 8
     */
311 8
    public function setUsername($username)
312
    {
313
        $this->username = $username;
314
    }
315
316 2
    /**
317
     * @return null|string
318 2
     */
319
    public function getFirstName()
320
    {
321
        return $this->firstName;
322
    }
323
324 8
    /**
325
     * @param string $firstName
326 8
     * @return void
327 8
     */
328
    public function setFirstName($firstName)
329
    {
330
        $this->firstName = $firstName;
331
    }
332 2
333
    /**
334 2
     * @return null|string
335
     */
336
    public function getLastName()
337
    {
338
        return $this->lastName;
339
    }
340 8
341
    /**
342 8
     * @param string $lastName
343 8
     * @return void
344
     */
345
    public function setLastName($lastName)
346
    {
347
        $this->lastName = $lastName;
348 1
    }
349
350 1
    /**
351
     * @return ChatPhoto|null
352
     */
353
    public function getPhoto()
354
    {
355
        return $this->photo;
356 2
    }
357
358 2
    /**
359 2
     * @param ChatPhoto $photo
360
     * @return void
361
     */
362
    public function setPhoto($photo)
363
    {
364 2
        $this->photo = $photo;
365
    }
366 2
367
    /**
368
     * @return null|string
369
     */
370
    public function getBio()
371
    {
372 3
        return $this->bio;
373
    }
374 3
375 3
    /**
376
     * @param string $bio
377
     * @return void
378
     */
379
    public function setBio($bio)
380 1
    {
381
        $this->bio = $bio;
382 1
    }
383
384
    /**
385
     * @return null|string
386
     */
387
    public function getDescription()
388 2
    {
389
        return $this->description;
390 2
    }
391 2
392
    /**
393
     * @param string $description
394
     * @return void
395
     */
396
    public function setDescription($description)
397
    {
398
        $this->description = $description;
399
    }
400
401
    /**
402
     * @return null|string
403
     */
404
    public function getInviteLink()
405
    {
406
        return $this->inviteLink;
407
    }
408
409
    /**
410
     * @param string $inviteLink
411
     * @return void
412
     */
413
    public function setInviteLink($inviteLink)
414
    {
415
        $this->inviteLink = $inviteLink;
416
    }
417
418
    /**
419
     * @return Message|null
420
     */
421
    public function getPinnedMessage()
422
    {
423
        return $this->pinnedMessage;
424
    }
425
426
    /**
427
     * @param Message $pinnedMessage
428
     * @return void
429
     */
430
    public function setPinnedMessage($pinnedMessage)
431
    {
432
        $this->pinnedMessage = $pinnedMessage;
433
    }
434
435
    /**
436
     * @return ChatPermissions|null
437
     */
438
    public function getPermissions()
439
    {
440
        return $this->permissions;
441
    }
442
443
    /**
444
     * @param ChatPermissions $permissions
445
     * @return void
446
     */
447
    public function setPermissions($permissions)
448
    {
449
        $this->permissions = $permissions;
450
    }
451
452
    /**
453
     * @return int|null
454
     */
455
    public function getSlowModeDelay()
456
    {
457
        return $this->slowModeDelay;
458
    }
459
460
    /**
461
     * @param int $slowModeDelay
462
     * @return void
463
     */
464
    public function setSlowModeDelay($slowModeDelay)
465
    {
466
        $this->slowModeDelay = $slowModeDelay;
467
    }
468
469
    /**
470
     * @return null|string
471
     */
472
    public function getStickerSetName()
473
    {
474
        return $this->stickerSetName;
475
    }
476
477
    /**
478
     * @param string $stickerSetName
479
     * @return void
480
     */
481
    public function setStickerSetName($stickerSetName)
482
    {
483
        $this->stickerSetName = $stickerSetName;
484
    }
485
486
    /**
487
     * @return bool|null
488
     */
489
    public function getCanSetStickerSet()
490
    {
491
        return $this->canSetStickerSet;
492
    }
493
494
    /**
495
     * @param bool $canSetStickerSet
496
     * @return void
497
     */
498
    public function setCanSetStickerSet($canSetStickerSet)
499
    {
500
        $this->canSetStickerSet = $canSetStickerSet;
501
    }
502
503
    /**
504
     * @return int|null
505
     */
506
    public function getLinkedChatId()
507
    {
508
        return $this->linkedChatId;
509
    }
510
511
    /**
512
     * @param int $linkedChatId
513
     * @return void
514
     */
515
    public function setLinkedChatId($linkedChatId)
516
    {
517
        $this->linkedChatId = $linkedChatId;
518
    }
519
520
    /**
521
     * @return ChatLocation|null
522
     */
523
    public function getLocation()
524
    {
525
        return $this->location;
526
    }
527
528
    /**
529
     * @param ChatLocation $location
530
     * @return void
531
     */
532
    public function setLocation($location)
533
    {
534
        $this->location = $location;
535
    }
536
537
    /**
538
     * @return bool|null
539
     */
540
    public function getJoinToSendMessages()
541
    {
542
        return $this->joinToSendMessages;
543
    }
544
545
    /**
546
     * @param bool $joinToSendMessages
547
     * @return void
548
     */
549
    public function setJoinToSendMessages($joinToSendMessages)
550
    {
551
        $this->joinToSendMessages = $joinToSendMessages;
552
    }
553
554
    /**
555
     * @return bool|null
556
     */
557
    public function getJoinByRequest()
558
    {
559
        return $this->joinByRequest;
560
    }
561
562
    /**
563
     * @param bool $joinByRequest
564
     * @return void
565
     */
566
    public function setJoinByRequest($joinByRequest)
567
    {
568
        $this->joinByRequest = $joinByRequest;
569
    }
570
571
    /**
572
     * @return int|null
573
     */
574
    public function getMessageAutoDeleteTime()
575
    {
576
        return $this->messageAutoDeleteTime;
577
    }
578
579
    /**
580
     * @param int $messageAutoDeleteTime
581
     * @return void
582
     */
583
    public function setMessageAutoDeleteTime($messageAutoDeleteTime)
584
    {
585
        $this->messageAutoDeleteTime = $messageAutoDeleteTime;
586
    }
587
588
    /**
589
     * @return bool|null
590
     */
591
    public function getHasProtectedContent()
592
    {
593
        return $this->hasProtectedContent;
594
    }
595
596
    /**
597
     * @param bool $hasProtectedContent
598
     * @return void
599
     */
600
    public function setHasProtectedContent($hasProtectedContent)
601
    {
602
        $this->hasProtectedContent = $hasProtectedContent;
603
    }
604
605
    /**
606
     * @return bool|null
607
     */
608
    public function getIsForum()
609
    {
610
        return $this->isForum;
611
    }
612
613
    /**
614
     * @param bool $isForum
615
     * @return void
616
     */
617
    public function setIsForum($isForum)
618
    {
619
        $this->isForum = $isForum;
620
    }
621
622
    /**
623
     * @return array[]|null
624
     *
625
     * @psalm-return array<array>|null
626
     */
627
    public function getActiveUsernames()
628
    {
629
        return $this->activeUsernames;
630
    }
631
632
    /**
633
     * @param array $activeUsernames
634
     * @return void
635
     */
636
    public function setActiveUsernames($activeUsernames)
637
    {
638
        $this->activeUsernames = $activeUsernames;
639
    }
640
641
    /**
642
     * @return null|string
643
     */
644
    public function getEmojiStatusCustomEmojiId()
645
    {
646
        return $this->emojiStatusCustomEmojiId;
647
    }
648
649
    /**
650
     * @param string $emojiStatusCustomEmojiId
651
     * @return void
652
     */
653
    public function setEmojiStatusCustomEmojiId($emojiStatusCustomEmojiId)
654
    {
655
        $this->emojiStatusCustomEmojiId = $emojiStatusCustomEmojiId;
656
    }
657
658
    /**
659
     * @return bool|null
660
     */
661
    public function getHasPrivateForwards()
662
    {
663
        return $this->hasPrivateForwards;
664
    }
665
666
    /**
667
     * @param bool $hasPrivateForwards
668
     * @return void
669
     */
670
    public function setHasPrivateForwards($hasPrivateForwards)
671
    {
672
        $this->hasPrivateForwards = $hasPrivateForwards;
673
    }
674
675
    /**
676
     * @return bool|null
677
     */
678
    public function getHasRestrictedVoiceAndVideoMessages()
679
    {
680
        return $this->hasRestrictedVoiceAndVideoMessages;
681
    }
682
683
    /**
684
     * @param bool $hasRestrictedVoiceAndVideoMessages
685
     * @return void
686
     */
687
    public function setHasRestrictedVoiceAndVideoMessages($hasRestrictedVoiceAndVideoMessages)
688
    {
689
        $this->hasRestrictedVoiceAndVideoMessages = $hasRestrictedVoiceAndVideoMessages;
690
    }
691
}
692