Passed
Push — master ( 58897c...6910c8 )
by Alexander
06:09 queued 12s
created

Chat::setLastName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
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
    static protected $requiredParams = ['id', 'type'];
17
18
    /**
19
     * {@inheritdoc}
20
     *
21
     * @var array
22
     */
23
    static protected $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|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
70
     */
71
    protected $title;
72
73
    /**
74
     * Optional. Username, for private chats and channels if available
75
     *
76
     * @var string
77
     */
78
    protected $username;
79
80
    /**
81
     * Optional. First name of the other party in a private chat
82
     *
83
     * @var string
84
     */
85
    protected $firstName;
86
87
    /**
88
     * Optional. Last name of the other party in a private chat
89
     *
90
     * @var string
91
     */
92
    protected $lastName;
93
94
    /**
95
     * Optional. Chat photo. Returned only in getChat.
96
     *
97
     * @var ChatPhoto
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
105
     */
106
    protected $bio;
107
108
    /**
109
     * Optional. Description, for supergroups and channel chats. Returned only in getChat.
110
     *
111
     * @var string
112
     */
113
    protected $description;
114
115
    /**
116
     * Optional. Chat invite link, for supergroups and channel chats. Returned only in getChat.
117
     *
118
     * @var string
119
     */
120
    protected $inviteLink;
121
122
    /**
123
     * Optional. Pinned message, for supergroups. Returned only in getChat.
124
     *
125
     * @var Message
126
     */
127
    protected $pinnedMessage;
128
129
    /**
130
     * Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat.
131
     *
132
     * @var ChatPermissions
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
141
     */
142
    protected $slowModeDelay;
143
144
    /**
145
     * Optional. For supergroups, name of group sticker set. Returned only in getChat.
146
     *
147
     * @var string
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
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
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
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
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
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
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
201
     */
202
    protected $hasProtectedContent;
203
204
    /**
205
     * Optional. True, if the supergroup chat is a forum (has topics enabled)
206
     *
207
     * @var bool
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[]
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
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
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
240
     */
241
    protected $hasRestrictedVoiceAndVideoMessages;
242
243
    /**
244
     * @return int|string
245
     */
246 3
    public function getId()
247
    {
248 3
        return $this->id;
249
    }
250
251
    /**
252
     * @param int|string $id
253
     *
254
     * @throws InvalidArgumentException
255
     */
256 23
    public function setId($id)
257
    {
258 23
        if (is_integer($id) || is_float($id) || is_string($id)) {
0 ignored issues
show
introduced by
The condition is_string($id) is always true.
Loading history...
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
     */
276 20
    public function setType($type)
277
    {
278 20
        $this->type = $type;
279 20
    }
280
281
    /**
282
     * @return string
283
     */
284 2
    public function getTitle()
285
    {
286 2
        return $this->title;
287
    }
288
289
    /**
290
     * @param string $title
291
     */
292 14
    public function setTitle($title)
293
    {
294 14
        $this->title = $title;
295 14
    }
296
297
    /**
298
     * @return string
299
     */
300 2
    public function getUsername()
301
    {
302 2
        return $this->username;
303
    }
304
305
    /**
306
     * @param string $username
307
     */
308 8
    public function setUsername($username)
309
    {
310 8
        $this->username = $username;
311 8
    }
312
313
    /**
314
     * @return string
315
     */
316 2
    public function getFirstName()
317
    {
318 2
        return $this->firstName;
319
    }
320
321
    /**
322
     * @param string $firstName
323
     */
324 8
    public function setFirstName($firstName)
325
    {
326 8
        $this->firstName = $firstName;
327 8
    }
328
329
    /**
330
     * @return string
331
     */
332 2
    public function getLastName()
333
    {
334 2
        return $this->lastName;
335
    }
336
337
    /**
338
     * @param string $lastName
339
     */
340 8
    public function setLastName($lastName)
341
    {
342 8
        $this->lastName = $lastName;
343 8
    }
344
345
    /**
346
     * @return ChatPhoto
347
     */
348 1
    public function getPhoto()
349
    {
350 1
        return $this->photo;
351
    }
352
353
    /**
354
     * @param ChatPhoto $photo
355
     */
356 2
    public function setPhoto($photo)
357
    {
358 2
        $this->photo = $photo;
359 2
    }
360
361
    /**
362
     * @return string
363
     */
364 2
    public function getBio()
365
    {
366 2
        return $this->bio;
367
    }
368
369
    /**
370
     * @param string $bio
371
     */
372 3
    public function setBio($bio)
373
    {
374 3
        $this->bio = $bio;
375 3
    }
376
377
    /**
378
     * @return string
379
     */
380 1
    public function getDescription()
381
    {
382 1
        return $this->description;
383
    }
384
385
    /**
386
     * @param string $description
387
     */
388 2
    public function setDescription($description)
389
    {
390 2
        $this->description = $description;
391 2
    }
392
393
    /**
394
     * @return string
395
     */
396
    public function getInviteLink()
397
    {
398
        return $this->inviteLink;
399
    }
400
401
    /**
402
     * @param string $inviteLink
403
     */
404
    public function setInviteLink($inviteLink)
405
    {
406
        $this->inviteLink = $inviteLink;
407
    }
408
409
    /**
410
     * @return Message
411
     */
412
    public function getPinnedMessage()
413
    {
414
        return $this->pinnedMessage;
415
    }
416
417
    /**
418
     * @param Message $pinnedMessage
419
     */
420
    public function setPinnedMessage($pinnedMessage)
421
    {
422
        $this->pinnedMessage = $pinnedMessage;
423
    }
424
425
    /**
426
     * @return ChatPermissions
427
     */
428
    public function getPermissions()
429
    {
430
        return $this->permissions;
431
    }
432
433
    /**
434
     * @param ChatPermissions $permissions
435
     */
436
    public function setPermissions($permissions)
437
    {
438
        $this->permissions = $permissions;
439
    }
440
441
    /**
442
     * @return int
443
     */
444
    public function getSlowModeDelay()
445
    {
446
        return $this->slowModeDelay;
447
    }
448
449
    /**
450
     * @param int $slowModeDelay
451
     */
452
    public function setSlowModeDelay($slowModeDelay)
453
    {
454
        $this->slowModeDelay = $slowModeDelay;
455
    }
456
457
    /**
458
     * @return string
459
     */
460
    public function getStickerSetName()
461
    {
462
        return $this->stickerSetName;
463
    }
464
465
    /**
466
     * @param string $stickerSetName
467
     */
468
    public function setStickerSetName($stickerSetName)
469
    {
470
        $this->stickerSetName = $stickerSetName;
471
    }
472
473
    /**
474
     * @return bool
475
     */
476
    public function getCanSetStickerSet()
477
    {
478
        return $this->canSetStickerSet;
479
    }
480
481
    /**
482
     * @param bool $canSetStickerSet
483
     */
484
    public function setCanSetStickerSet($canSetStickerSet)
485
    {
486
        $this->canSetStickerSet = $canSetStickerSet;
487
    }
488
489
    /**
490
     * @return int
491
     */
492
    public function getLinkedChatId()
493
    {
494
        return $this->linkedChatId;
495
    }
496
497
    /**
498
     * @param int $linkedChatId
499
     */
500
    public function setLinkedChatId($linkedChatId)
501
    {
502
        $this->linkedChatId = $linkedChatId;
503
    }
504
505
    /**
506
     * @return ChatLocation
507
     */
508
    public function getLocation()
509
    {
510
        return $this->location;
511
    }
512
513
    /**
514
     * @param ChatLocation $location
515
     */
516
    public function setLocation($location)
517
    {
518
        $this->location = $location;
519
    }
520
521
    /**
522
     * @return bool
523
     */
524
    public function getJoinToSendMessages()
525
    {
526
        return $this->joinToSendMessages;
527
    }
528
529
    /**
530
     * @param bool $joinToSendMessages
531
     */
532
    public function setJoinToSendMessages($joinToSendMessages)
533
    {
534
        $this->joinToSendMessages = $joinToSendMessages;
535
    }
536
537
    /**
538
     * @return bool
539
     */
540
    public function getJoinByRequest()
541
    {
542
        return $this->joinByRequest;
543
    }
544
545
    /**
546
     * @param bool $joinByRequest
547
     */
548
    public function setJoinByRequest($joinByRequest)
549
    {
550
        $this->joinByRequest = $joinByRequest;
551
    }
552
553
    /**
554
     * @return int
555
     */
556
    public function getMessageAutoDeleteTime()
557
    {
558
        return $this->messageAutoDeleteTime;
559
    }
560
561
    /**
562
     * @param int $messageAutoDeleteTime
563
     */
564
    public function setMessageAutoDeleteTime($messageAutoDeleteTime)
565
    {
566
        $this->messageAutoDeleteTime = $messageAutoDeleteTime;
567
    }
568
569
    /**
570
     * @return bool
571
     */
572
    public function getHasProtectedContent()
573
    {
574
        return $this->hasProtectedContent;
575
    }
576
577
    /**
578
     * @param bool $hasProtectedContent
579
     */
580
    public function setHasProtectedContent($hasProtectedContent)
581
    {
582
        $this->hasProtectedContent = $hasProtectedContent;
583
    }
584
585
    /**
586
     * @return bool
587
     */
588
    public function getIsForum()
589
    {
590
        return $this->isForum;
591
    }
592
593
    /**
594
     * @param bool $isForum
595
     */
596
    public function setIsForum($isForum)
597
    {
598
        $this->isForum = $isForum;
599
    }
600
601
    /**
602
     * @return array
603
     */
604
    public function getActiveUsernames()
605
    {
606
        return $this->activeUsernames;
607
    }
608
609
    /**
610
     * @param array $activeUsernames
611
     */
612
    public function setActiveUsernames($activeUsernames)
613
    {
614
        $this->activeUsernames = $activeUsernames;
615
    }
616
617
    /**
618
     * @return bool
619
     */
620
    public function getEmojiStatusCustomEmojiId()
621
    {
622
        return $this->emojiStatusCustomEmojiId;
623
    }
624
625
    /**
626
     * @param bool $emojiStatusCustomEmojiId
627
     */
628
    public function setEmojiStatusCustomEmojiId($emojiStatusCustomEmojiId)
629
    {
630
        $this->emojiStatusCustomEmojiId = $emojiStatusCustomEmojiId;
0 ignored issues
show
Documentation Bug introduced by
The property $emojiStatusCustomEmojiId was declared of type string, but $emojiStatusCustomEmojiId is of type boolean. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
631
    }
632
633
    /**
634
     * @return bool
635
     */
636
    public function getHasPrivateForwards()
637
    {
638
        return $this->hasPrivateForwards;
639
    }
640
641
    /**
642
     * @param bool $hasPrivateForwards
643
     */
644
    public function setHasPrivateForwards($hasPrivateForwards)
645
    {
646
        $this->hasPrivateForwards = $hasPrivateForwards;
647
    }
648
649
    /**
650
     * @return bool
651
     */
652
    public function getHasRestrictedVoiceAndVideoMessages()
653
    {
654
        return $this->hasRestrictedVoiceAndVideoMessages;
655
    }
656
657
    /**
658
     * @param bool $hasRestrictedVoiceAndVideoMessages
659
     */
660
    public function setHasRestrictedVoiceAndVideoMessages($hasRestrictedVoiceAndVideoMessages)
661
    {
662
        $this->hasRestrictedVoiceAndVideoMessages = $hasRestrictedVoiceAndVideoMessages;
663
    }
664
}
665