ChatMember::setCanSendMessages()   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 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
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
7
class ChatMember extends BaseType
8
{
9
    /**
10
     * {@inheritdoc}
11
     *
12
     * @var array
13
     */
14
    protected static $requiredParams = ['user', 'status'];
15
16
    /**
17
     * {@inheritdoc}
18
     *
19
     * @var array
20
     */
21
    protected static $map = [
22
        'user' => User::class,
23
        'status' => true,
24
        'until_date' => true,
25
        'can_be_edited' => true,
26
        'can_change_info' => true,
27
        'can_post_messages' => true,
28
        'can_edit_messages' => true,
29
        'can_delete_messages' => true,
30
        'can_invite_users' => true,
31
        'can_restrict_members' => true,
32
        'can_pin_messages' => true,
33
        'can_promote_members' => true,
34
        'can_send_messages' => true,
35
        'can_send_media_messages' => true,
36
        'can_send_other_messages' => true,
37
        'can_add_web_page_previews' => true,
38
        'can_manage_topics' => true,
39
        'is_anonymous' => true,
40
        'custom_title' => true,
41
        'can_manage_chat' => true,
42
        'can_send_polls' => true,
43
    ];
44
45
    /**
46
     * Information about the user
47
     *
48
     * @var User
49
     */
50
    protected $user;
51
52
    /**
53
     * The member's status in the chat. Can be “creator”, “administrator”, “member”, “restricted”, “left” or “kicked”
54
     *
55
     * @var string
56
     */
57
    protected $status;
58
59
    /**
60
     * Optional. Restricted and kicked only. Date when restrictions will be lifted for this user, unix time
61
     *
62
     * @var integer|null
63
     */
64
    protected $untilDate;
65
66
    /**
67
     * Optional. Administrators only. True, if the bot is allowed to edit administrator privileges of that user
68
     *
69
     * @var bool|null
70
     */
71
    protected $canBeEdited;
72
73
    /**
74
     * Optional. Administrators only. True, if the administrator can change the chat title, photo and other settings
75
     *
76
     * @var bool|null
77
     */
78
    protected $canChangeInfo;
79
80
    /**
81
     * Optional. Administrators only. True, if the administrator can post in the channel, channels only
82
     *
83
     * @var bool|null
84
     */
85
    protected $canPostMessages;
86
87
    /**
88
     * Optional. Administrators only. True, if the administrator can edit messages of other users, channels only
89
     *
90
     * @var bool|null
91
     */
92
    protected $canEditMessages;
93
94
    /**
95
     * Optional. Administrators only. True, if the administrator can delete messages of other users
96
     *
97
     * @var bool|null
98
     */
99
    protected $canDeleteMessages;
100
101
    /**
102
     * Optional. Administrators only. True, if the administrator can invite new users to the chat
103
     *
104
     * @var bool|null
105
     */
106
    protected $canInviteUsers;
107
108
    /**
109
     * Optional. Administrators only. True, if the administrator can restrict, ban or unban chat members
110
     *
111
     * @var bool|null
112
     */
113
    protected $canRestrictMembers;
114
115
    /**
116
     * Optional. Administrators only. True, if the administrator can pin messages, supergroups only
117
     *
118
     * @var bool|null
119
     */
120
    protected $canPinMessages;
121
122
    /**
123
     * Optional. Administrators only. True, if the administrator can add new administrators with a subset of his own
124
     * privileges or demote administrators that he has promoted, directly or indirectly
125
     * (promoted by administrators that were appointed by the user)
126
     *
127
     * @var bool|null
128
     */
129
    protected $canPromoteMembers;
130
131
    /**
132
     * Optional. Restricted only. True, if the user can send text messages, contacts, locations and venues
133
     *
134
     * @var bool|null
135
     */
136
    protected $canSendMessages;
137
138
    /**
139
     * Optional. Restricted only. True, if the user can send audios, documents, photos, videos, video notes
140
     * and voice notes, implies can_send_messages
141
     *
142
     * @var bool|null
143
     */
144
    protected $canSendMediaMessages;
145
146
    /**
147
     * Optional. Restricted only. True, if the user can send animations, games, stickers and use inline bots,
148
     * implies can_send_media_messages
149
     *
150
     * @var bool|null
151
     */
152
    protected $canSendOtherMessages;
153
154
    /**
155
     * Optional. Restricted only. True, if user may add web page previews to his messages,
156
     * implies can_send_media_messages
157
     *
158
     * @var bool|null
159
     */
160
    protected $canAddWebPagePreviews;
161
162
    /**
163
     * Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only
164
     *
165
     * @var bool|null
166
     */
167
    protected $canManageTopics;
168
169
    /**
170
     * True, if the user's presence in the chat is hidden
171
     *
172
     * @var bool
173
     */
174
    protected $isAnonymous;
175
176
    /**
177
     * Optional. Custom title for this user
178
     *
179
     * @var string|null
180
     */
181
    protected $customTitle;
182
183
    /**
184
     * True, if the administrator can access the chat event log, chat statistics, message statistics in channels,
185
     * see channel members, see anonymous administrators in supergroups and ignore slow mode.
186
     * Implied by any other administrator privilege
187
     *
188
     * @var bool
189
     */
190
    protected $canManageChat;
191
192
    /**
193
     * True, if the user is allowed to send polls
194
     *
195
     * @var bool
196
     */
197
    protected $canSendPolls;
198
199
    /**
200
     * @return User
201
     */
202
    public function getUser()
203
    {
204
        return $this->user;
205
    }
206
207
    /**
208
     * @param User $user
209
     * @return void
210
     */
211
    public function setUser($user)
212
    {
213
        $this->user = $user;
214
    }
215
216
    /**
217
     * @return string
218
     */
219
    public function getStatus()
220
    {
221
        return $this->status;
222
    }
223
224
    /**
225
     * @param string $status
226
     * @return void
227
     */
228
    public function setStatus($status)
229
    {
230
        $this->status = $status;
231
    }
232
233
    /**
234
     * @return int|null
235
     */
236
    public function getUntilDate()
237
    {
238
        return $this->untilDate;
239
    }
240
241
    /**
242
     * @param int $untilDate
243
     * @return void
244
     */
245
    public function setUntilDate($untilDate)
246
    {
247
        $this->untilDate = $untilDate;
248
    }
249
250
    /**
251
     * @return bool|null
252
     */
253
    public function getCanBeEdited()
254
    {
255
        return $this->canBeEdited;
256
    }
257
258
    /**
259
     * @param bool $canBeEdited
260
     * @return void
261
     */
262
    public function setCanBeEdited($canBeEdited)
263
    {
264
        $this->canBeEdited = $canBeEdited;
265
    }
266
267
    /**
268
     * @return bool|null
269
     */
270
    public function getCanChangeInfo()
271
    {
272
        return $this->canChangeInfo;
273
    }
274
275
    /**
276
     * @param bool $canChangeInfo
277
     * @return void
278
     */
279
    public function setCanChangeInfo($canChangeInfo)
280
    {
281
        $this->canChangeInfo = $canChangeInfo;
282
    }
283
284
    /**
285
     * @return bool|null
286
     */
287
    public function getCanPostMessages()
288
    {
289
        return $this->canPostMessages;
290
    }
291
292
    /**
293
     * @param bool $canPostMessages
294
     * @return void
295
     */
296
    public function setCanPostMessages($canPostMessages)
297
    {
298
        $this->canPostMessages = $canPostMessages;
299
    }
300
301
    /**
302
     * @return bool|null
303
     */
304
    public function getCanEditMessages()
305
    {
306
        return $this->canEditMessages;
307
    }
308
309
    /**
310
     * @param bool $canEditMessages
311
     * @return void
312
     */
313
    public function setCanEditMessages($canEditMessages)
314
    {
315
        $this->canEditMessages = $canEditMessages;
316
    }
317
318
    /**
319
     * @return bool|null
320
     */
321
    public function getCanDeleteMessages()
322
    {
323
        return $this->canDeleteMessages;
324
    }
325
326
    /**
327
     * @param bool $canDeleteMessages
328
     * @return void
329
     */
330
    public function setCanDeleteMessages($canDeleteMessages)
331
    {
332
        $this->canDeleteMessages = $canDeleteMessages;
333
    }
334
335
    /**
336
     * @return bool|null
337
     */
338
    public function getCanInviteUsers()
339
    {
340
        return $this->canInviteUsers;
341
    }
342
343
    /**
344
     * @param bool $canInviteUsers
345
     * @return void
346
     */
347
    public function setCanInviteUsers($canInviteUsers)
348
    {
349
        $this->canInviteUsers = $canInviteUsers;
350
    }
351
352
    /**
353
     * @return bool|null
354
     */
355
    public function getCanRestrictMembers()
356
    {
357
        return $this->canRestrictMembers;
358
    }
359
360
    /**
361
     * @param bool $canRestrictMembers
362
     * @return void
363
     */
364
    public function setCanRestrictMembers($canRestrictMembers)
365
    {
366
        $this->canRestrictMembers = $canRestrictMembers;
367
    }
368
369
    /**
370
     * @return bool|null
371
     */
372
    public function getCanPinMessages()
373
    {
374
        return $this->canPinMessages;
375
    }
376
377
    /**
378
     * @param bool $canPinMessages
379
     * @return void
380
     */
381
    public function setCanPinMessages($canPinMessages)
382
    {
383
        $this->canPinMessages = $canPinMessages;
384
    }
385
386
    /**
387
     * @return bool|null
388
     */
389
    public function getCanPromoteMembers()
390
    {
391
        return $this->canPromoteMembers;
392
    }
393
394
    /**
395
     * @param bool $canPromoteMembers
396
     * @return void
397
     */
398
    public function setCanPromoteMembers($canPromoteMembers)
399
    {
400
        $this->canPromoteMembers = $canPromoteMembers;
401
    }
402
403
    /**
404
     * @return bool|null
405
     */
406
    public function getCanSendMessages()
407
    {
408
        return $this->canSendMessages;
409
    }
410
411
    /**
412
     * @param bool $canSendMessages
413
     * @return void
414
     */
415
    public function setCanSendMessages($canSendMessages)
416
    {
417
        $this->canSendMessages = $canSendMessages;
418
    }
419
420
    /**
421
     * @return bool|null
422
     */
423
    public function getCanSendMediaMessages()
424
    {
425
        return $this->canSendMediaMessages;
426
    }
427
428
    /**
429
     * @param bool $canSendMediaMessages
430
     * @return void
431
     */
432
    public function setCanSendMediaMessages($canSendMediaMessages)
433
    {
434
        $this->canSendMediaMessages = $canSendMediaMessages;
435
    }
436
437
    /**
438
     * @return bool|null
439
     */
440
    public function getCanSendOtherMessages()
441
    {
442
        return $this->canSendOtherMessages;
443
    }
444
445
    /**
446
     * @param bool $canSendOtherMessages
447
     * @return void
448
     */
449
    public function setCanSendOtherMessages($canSendOtherMessages)
450
    {
451
        $this->canSendOtherMessages = $canSendOtherMessages;
452
    }
453
454
    /**
455
     * @return bool|null
456
     */
457
    public function getCanAddWebPagePreviews()
458
    {
459
        return $this->canAddWebPagePreviews;
460
    }
461
462
    /**
463
     * @param bool $canAddWebPagePreviews
464
     * @return void
465
     */
466
    public function setCanAddWebPagePreviews($canAddWebPagePreviews)
467
    {
468
        $this->canAddWebPagePreviews = $canAddWebPagePreviews;
469
    }
470
471
    /**
472
     * @return bool
473
     */
474
    public function getCanManageChat()
475
    {
476
        return $this->canManageChat;
477
    }
478
479
    /**
480
     * @param bool $canManageChat
481
     * @return void
482
     */
483
    public function setCanManageChat($canManageChat)
484
    {
485
        $this->canManageChat = $canManageChat;
486
    }
487
488
    /**
489
     * @return bool
490
     */
491
    public function getIsAnonymous()
492
    {
493
        return $this->isAnonymous;
494
    }
495
496
    /**
497
     * @param bool $isAnonymous
498
     * @return void
499
     */
500
    public function setIsAnonymous($isAnonymous)
501
    {
502
        $this->isAnonymous = $isAnonymous;
503
    }
504
505
    /**
506
     * @return bool
507
     */
508
    public function getCanSendPolls()
509
    {
510
        return $this->canSendPolls;
511
    }
512
513
    /**
514
     * @param bool $canSendPolls
515
     * @return void
516
     */
517
    public function setCanSendPolls($canSendPolls)
518
    {
519
        $this->canSendPolls = $canSendPolls;
520
    }
521
522
    /**
523
     * @return bool|null
524
     */
525
    public function getCanManageTopics()
526
    {
527
        return $this->canManageTopics;
528
    }
529
530
    /**
531
     * @param bool $canManageTopics
532
     * @return void
533
     */
534
    public function setCanManageTopics($canManageTopics)
535
    {
536
        $this->canManageTopics = $canManageTopics;
537
    }
538
539
    /**
540
     * @return null|string
541
     */
542
    public function getCustomTitle()
543
    {
544
        return $this->customTitle;
545
    }
546
547
    /**
548
     * @param string $customTitle
549
     * @return void
550
     */
551
    public function setCustomTitle($customTitle)
552
    {
553
        $this->customTitle = $customTitle;
554
    }
555
}
556