ChatPermissions   A
last analyzed

Complexity

Total Complexity 16

Size/Duplication

Total Lines 219
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 16
eloc 35
c 1
b 0
f 0
dl 0
loc 219
ccs 0
cts 64
cp 0
rs 10

16 Methods

Rating   Name   Duplication   Size   Complexity  
A isCanSendMessages() 0 3 1
A setCanAddWebPagePreviews() 0 3 1
A setCanSendOtherMessages() 0 3 1
A setCanChangeInfo() 0 3 1
A setCanSendMediaMessages() 0 3 1
A setCanPinMessages() 0 3 1
A setCanSendMessages() 0 3 1
A isCanSendOtherMessages() 0 3 1
A isCanSendMediaMessages() 0 3 1
A setCanInviteUsers() 0 3 1
A isCanPinMessages() 0 3 1
A isCanInviteUsers() 0 3 1
A isCanAddWebPagePreviews() 0 3 1
A isCanChangeInfo() 0 3 1
A isCanSendPolls() 0 3 1
A setCanSendPolls() 0 3 1
1
<?php
2
3
namespace TelegramBot\Api\Types;
4
5
use TelegramBot\Api\BaseType;
6
use TelegramBot\Api\TypeInterface;
7
8
class ChatPermissions extends BaseType implements TypeInterface
9
{
10
    /**
11
     * {@inheritdoc}
12
     *
13
     * @var array
14
     */
15
    protected static $requiredParams = [];
16
17
    /**
18
     * {@inheritdoc}
19
     *
20
     * @var array
21
     */
22
    protected static $map = [
23
        'can_send_messages' => true,
24
        'can_send_media_messages' => true,
25
        'can_send_polls' => true,
26
        'can_send_other_messages' => true,
27
        'can_add_web_page_previews' => true,
28
        'can_change_info' => true,
29
        'can_invite_users' => true,
30
        'can_pin_messages' => true,
31
    ];
32
33
    /**
34
     * Optional. True, if the user is allowed to send text messages, contacts, locations and venues
35
     *
36
     * @var bool|null
37
     */
38
    protected $canSendMessages;
39
40
    /**
41
     * Optional. True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes,
42
     * implies can_send_messages
43
     *
44
     * @var bool|null
45
     */
46
    protected $canSendMediaMessages;
47
48
    /**
49
     * Optional. True, if the user is allowed to send polls, implies can_send_messages
50
     *
51
     * @var bool|null
52
     */
53
    protected $canSendPolls;
54
55
    /**
56
     * Optional. True, if the user is allowed to send animations, games, stickers and use inline bots, implies
57
     * can_send_media_messages
58
     *
59
     * @var bool|null
60
     */
61
    protected $canSendOtherMessages;
62
63
    /**
64
     * Optional. True, if the user is allowed to add web page previews to their messages, implies
65
     * can_send_media_messages
66
     *
67
     * @var bool|null
68
     */
69
    protected $canAddWebPagePreviews;
70
71
    /**
72
     * Optional. True, if the user is allowed to change the chat title, photo and other settings. Ignored in public
73
     * supergroups
74
     *
75
     * @var bool|null
76
     */
77
    protected $canChangeInfo;
78
79
    /**
80
     * Optional. True, if the user is allowed to invite new users to the chat
81
     *
82
     * @var bool|null
83
     */
84
    protected $canInviteUsers;
85
86
    /**
87
     * Optional. True, if the user is allowed to pin messages. Ignored in public supergroups
88
     *
89
     * @var bool|null
90
     */
91
    protected $canPinMessages;
92
93
    /**
94
     * @return bool|null
95
     */
96
    public function isCanSendMessages()
97
    {
98
        return $this->canSendMessages;
99
    }
100
101
    /**
102
     * @param bool $canSendMessages
103
     * @return void
104
     */
105
    public function setCanSendMessages($canSendMessages)
106
    {
107
        $this->canSendMessages = $canSendMessages;
108
    }
109
110
    /**
111
     * @return bool|null
112
     */
113
    public function isCanSendMediaMessages()
114
    {
115
        return $this->canSendMediaMessages;
116
    }
117
118
    /**
119
     * @param bool $canSendMediaMessages
120
     * @return void
121
     */
122
    public function setCanSendMediaMessages($canSendMediaMessages)
123
    {
124
        $this->canSendMediaMessages = $canSendMediaMessages;
125
    }
126
127
    /**
128
     * @return bool|null
129
     */
130
    public function isCanSendPolls()
131
    {
132
        return $this->canSendPolls;
133
    }
134
135
    /**
136
     * @param bool $canSendPolls
137
     * @return void
138
     */
139
    public function setCanSendPolls($canSendPolls)
140
    {
141
        $this->canSendPolls = $canSendPolls;
142
    }
143
144
    /**
145
     * @return bool|null
146
     */
147
    public function isCanSendOtherMessages()
148
    {
149
        return $this->canSendOtherMessages;
150
    }
151
152
    /**
153
     * @param bool $canSendOtherMessages
154
     * @return void
155
     */
156
    public function setCanSendOtherMessages($canSendOtherMessages)
157
    {
158
        $this->canSendOtherMessages = $canSendOtherMessages;
159
    }
160
161
    /**
162
     * @return bool|null
163
     */
164
    public function isCanAddWebPagePreviews()
165
    {
166
        return $this->canAddWebPagePreviews;
167
    }
168
169
    /**
170
     * @param bool $canAddWebPagePreviews
171
     * @return void
172
     */
173
    public function setCanAddWebPagePreviews($canAddWebPagePreviews)
174
    {
175
        $this->canAddWebPagePreviews = $canAddWebPagePreviews;
176
    }
177
178
    /**
179
     * @return bool|null
180
     */
181
    public function isCanChangeInfo()
182
    {
183
        return $this->canChangeInfo;
184
    }
185
186
    /**
187
     * @param bool $canChangeInfo
188
     * @return void
189
     */
190
    public function setCanChangeInfo($canChangeInfo)
191
    {
192
        $this->canChangeInfo = $canChangeInfo;
193
    }
194
195
    /**
196
     * @return bool|null
197
     */
198
    public function isCanInviteUsers()
199
    {
200
        return $this->canInviteUsers;
201
    }
202
203
    /**
204
     * @param bool $canInviteUsers
205
     * @return void
206
     */
207
    public function setCanInviteUsers($canInviteUsers)
208
    {
209
        $this->canInviteUsers = $canInviteUsers;
210
    }
211
212
    /**
213
     * @return bool|null
214
     */
215
    public function isCanPinMessages()
216
    {
217
        return $this->canPinMessages;
218
    }
219
220
    /**
221
     * @param bool $canPinMessages
222
     * @return void
223
     */
224
    public function setCanPinMessages($canPinMessages)
225
    {
226
        $this->canPinMessages = $canPinMessages;
227
    }
228
}
229