ChatMemberStatusAdministrator::getCanPinMessages()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This phpFile is auto-generated.
5
 */
6
7
declare(strict_types=1);
8
9
namespace AurimasNiekis\TdLibSchema;
10
11
/**
12
 * The user is a member of a chat and has some additional privileges. In basic groups, administrators can edit and delete messages sent by others, add new members, and ban unprivileged members. In supergroups and channels, there are more detailed options for administrator privileges.
13
 */
14
class ChatMemberStatusAdministrator extends ChatMemberStatus
15
{
16
    public const TYPE_NAME = 'chatMemberStatusAdministrator';
17
18
    /**
19
     * A custom title of the administrator; 0-16 characters without emojis; applicable to supergroups only.
20
     *
21
     * @var string
22
     */
23
    protected string $customTitle;
24
25
    /**
26
     * True, if the current user can edit the administrator privileges for the called user.
27
     *
28
     * @var bool
29
     */
30
    protected bool $canBeEdited;
31
32
    /**
33
     * True, if the administrator can change the chat title, photo, and other settings.
34
     *
35
     * @var bool
36
     */
37
    protected bool $canChangeInfo;
38
39
    /**
40
     * True, if the administrator can create channel posts; applicable to channels only.
41
     *
42
     * @var bool
43
     */
44
    protected bool $canPostMessages;
45
46
    /**
47
     * True, if the administrator can edit messages of other users and pin messages; applicable to channels only.
48
     *
49
     * @var bool
50
     */
51
    protected bool $canEditMessages;
52
53
    /**
54
     * True, if the administrator can delete messages of other users.
55
     *
56
     * @var bool
57
     */
58
    protected bool $canDeleteMessages;
59
60
    /**
61
     * True, if the administrator can invite new users to the chat.
62
     *
63
     * @var bool
64
     */
65
    protected bool $canInviteUsers;
66
67
    /**
68
     * True, if the administrator can restrict, ban, or unban chat members.
69
     *
70
     * @var bool
71
     */
72
    protected bool $canRestrictMembers;
73
74
    /**
75
     * True, if the administrator can pin messages; applicable to groups only.
76
     *
77
     * @var bool
78
     */
79
    protected bool $canPinMessages;
80
81
    /**
82
     * True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that were directly or indirectly promoted by them.
83
     *
84
     * @var bool
85
     */
86
    protected bool $canPromoteMembers;
87
88
    public function __construct(
89
        string $customTitle,
90
        bool $canBeEdited,
91
        bool $canChangeInfo,
92
        bool $canPostMessages,
93
        bool $canEditMessages,
94
        bool $canDeleteMessages,
95
        bool $canInviteUsers,
96
        bool $canRestrictMembers,
97
        bool $canPinMessages,
98
        bool $canPromoteMembers
99
    ) {
100
        parent::__construct();
101
102
        $this->customTitle        = $customTitle;
103
        $this->canBeEdited        = $canBeEdited;
104
        $this->canChangeInfo      = $canChangeInfo;
105
        $this->canPostMessages    = $canPostMessages;
106
        $this->canEditMessages    = $canEditMessages;
107
        $this->canDeleteMessages  = $canDeleteMessages;
108
        $this->canInviteUsers     = $canInviteUsers;
109
        $this->canRestrictMembers = $canRestrictMembers;
110
        $this->canPinMessages     = $canPinMessages;
111
        $this->canPromoteMembers  = $canPromoteMembers;
112
    }
113
114
    public static function fromArray(array $array): ChatMemberStatusAdministrator
115
    {
116
        return new static(
117
            $array['custom_title'],
118
            $array['can_be_edited'],
119
            $array['can_change_info'],
120
            $array['can_post_messages'],
121
            $array['can_edit_messages'],
122
            $array['can_delete_messages'],
123
            $array['can_invite_users'],
124
            $array['can_restrict_members'],
125
            $array['can_pin_messages'],
126
            $array['can_promote_members'],
127
        );
128
    }
129
130
    public function typeSerialize(): array
131
    {
132
        return [
133
            '@type'                => static::TYPE_NAME,
134
            'custom_title'         => $this->customTitle,
135
            'can_be_edited'        => $this->canBeEdited,
136
            'can_change_info'      => $this->canChangeInfo,
137
            'can_post_messages'    => $this->canPostMessages,
138
            'can_edit_messages'    => $this->canEditMessages,
139
            'can_delete_messages'  => $this->canDeleteMessages,
140
            'can_invite_users'     => $this->canInviteUsers,
141
            'can_restrict_members' => $this->canRestrictMembers,
142
            'can_pin_messages'     => $this->canPinMessages,
143
            'can_promote_members'  => $this->canPromoteMembers,
144
        ];
145
    }
146
147
    public function getCustomTitle(): string
148
    {
149
        return $this->customTitle;
150
    }
151
152
    public function getCanBeEdited(): bool
153
    {
154
        return $this->canBeEdited;
155
    }
156
157
    public function getCanChangeInfo(): bool
158
    {
159
        return $this->canChangeInfo;
160
    }
161
162
    public function getCanPostMessages(): bool
163
    {
164
        return $this->canPostMessages;
165
    }
166
167
    public function getCanEditMessages(): bool
168
    {
169
        return $this->canEditMessages;
170
    }
171
172
    public function getCanDeleteMessages(): bool
173
    {
174
        return $this->canDeleteMessages;
175
    }
176
177
    public function getCanInviteUsers(): bool
178
    {
179
        return $this->canInviteUsers;
180
    }
181
182
    public function getCanRestrictMembers(): bool
183
    {
184
        return $this->canRestrictMembers;
185
    }
186
187
    public function getCanPinMessages(): bool
188
    {
189
        return $this->canPinMessages;
190
    }
191
192
    public function getCanPromoteMembers(): bool
193
    {
194
        return $this->canPromoteMembers;
195
    }
196
}
197