SupergroupFullInfo::getMemberCount()   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 PHPTdGram\Schema;
10
11
/**
12
 * Contains full information about a supergroup or channel.
13
 */
14
class SupergroupFullInfo extends TdObject
15
{
16
    public const TYPE_NAME = 'supergroupFullInfo';
17
18
    /**
19
     * Supergroup or channel description.
20
     */
21
    protected string $description;
22
23
    /**
24
     * Number of members in the supergroup or channel; 0 if unknown.
25
     */
26
    protected int $memberCount;
27
28
    /**
29
     * Number of privileged users in the supergroup or channel; 0 if unknown.
30
     */
31
    protected int $administratorCount;
32
33
    /**
34
     * Number of restricted users in the supergroup; 0 if unknown.
35
     */
36
    protected int $restrictedCount;
37
38
    /**
39
     * Number of users banned from chat; 0 if unknown.
40
     */
41
    protected int $bannedCount;
42
43
    /**
44
     * Chat identifier of a discussion group for the channel, or a channel, for which the supergroup is the designated discussion group; 0 if none or unknown.
45
     */
46
    protected int $linkedChatId;
47
48
    /**
49
     * Delay between consecutive sent messages for non-administrator supergroup members, in seconds.
50
     */
51
    protected int $slowModeDelay;
52
53
    /**
54
     * Time left before next message can be sent in the supergroup, in seconds. An updateSupergroupFullInfo update is not triggered when value of this field changes, but both new and old values are non-zero.
55
     */
56
    protected float $slowModeDelayExpiresIn;
57
58
    /**
59
     * True, if members of the chat can be retrieved.
60
     */
61
    protected bool $canGetMembers;
62
63
    /**
64
     * True, if the chat username can be changed.
65
     */
66
    protected bool $canSetUsername;
67
68
    /**
69
     * True, if the supergroup sticker set can be changed.
70
     */
71
    protected bool $canSetStickerSet;
72
73
    /**
74
     * True, if the supergroup location can be changed.
75
     */
76
    protected bool $canSetLocation;
77
78
    /**
79
     * True, if the channel statistics is available through getChatStatisticsUrl.
80
     */
81
    protected bool $canViewStatistics;
82
83
    /**
84
     * True, if new chat members will have access to old messages. In public or discussion groups and both public and private channels, old messages are always available, so this option affects only private supergroups without a linked chat. The value of this field is only available for chat administrators.
85
     */
86
    protected bool $isAllHistoryAvailable;
87
88
    /**
89
     * Identifier of the supergroup sticker set; 0 if none.
90
     */
91
    protected string $stickerSetId;
92
93
    /**
94
     * Location to which the supergroup is connected; may be null.
95
     */
96
    protected ?ChatLocation $location;
97
98
    /**
99
     * Invite link for this chat.
100
     */
101
    protected string $inviteLink;
102
103
    /**
104
     * Identifier of the basic group from which supergroup was upgraded; 0 if none.
105
     */
106
    protected int $upgradedFromBasicGroupId;
107
108
    /**
109
     * Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none.
110
     */
111
    protected int $upgradedFromMaxMessageId;
112
113
    public function __construct(
114
        string $description,
115
        int $memberCount,
116
        int $administratorCount,
117
        int $restrictedCount,
118
        int $bannedCount,
119
        int $linkedChatId,
120
        int $slowModeDelay,
121
        float $slowModeDelayExpiresIn,
122
        bool $canGetMembers,
123
        bool $canSetUsername,
124
        bool $canSetStickerSet,
125
        bool $canSetLocation,
126
        bool $canViewStatistics,
127
        bool $isAllHistoryAvailable,
128
        string $stickerSetId,
129
        ?ChatLocation $location,
130
        string $inviteLink,
131
        int $upgradedFromBasicGroupId,
132
        int $upgradedFromMaxMessageId
133
    ) {
134
        $this->description              = $description;
135
        $this->memberCount              = $memberCount;
136
        $this->administratorCount       = $administratorCount;
137
        $this->restrictedCount          = $restrictedCount;
138
        $this->bannedCount              = $bannedCount;
139
        $this->linkedChatId             = $linkedChatId;
140
        $this->slowModeDelay            = $slowModeDelay;
141
        $this->slowModeDelayExpiresIn   = $slowModeDelayExpiresIn;
142
        $this->canGetMembers            = $canGetMembers;
143
        $this->canSetUsername           = $canSetUsername;
144
        $this->canSetStickerSet         = $canSetStickerSet;
145
        $this->canSetLocation           = $canSetLocation;
146
        $this->canViewStatistics        = $canViewStatistics;
147
        $this->isAllHistoryAvailable    = $isAllHistoryAvailable;
148
        $this->stickerSetId             = $stickerSetId;
149
        $this->location                 = $location;
150
        $this->inviteLink               = $inviteLink;
151
        $this->upgradedFromBasicGroupId = $upgradedFromBasicGroupId;
152
        $this->upgradedFromMaxMessageId = $upgradedFromMaxMessageId;
153
    }
154
155
    public static function fromArray(array $array): SupergroupFullInfo
156
    {
157
        return new static(
158
            $array['description'],
159
            $array['member_count'],
160
            $array['administrator_count'],
161
            $array['restricted_count'],
162
            $array['banned_count'],
163
            $array['linked_chat_id'],
164
            $array['slow_mode_delay'],
165
            $array['slow_mode_delay_expires_in'],
166
            $array['can_get_members'],
167
            $array['can_set_username'],
168
            $array['can_set_sticker_set'],
169
            $array['can_set_location'],
170
            $array['can_view_statistics'],
171
            $array['is_all_history_available'],
172
            $array['sticker_set_id'],
173
            (isset($array['location']) ? TdSchemaRegistry::fromArray($array['location']) : null),
174
            $array['invite_link'],
175
            $array['upgraded_from_basic_group_id'],
176
            $array['upgraded_from_max_message_id'],
177
        );
178
    }
179
180
    public function typeSerialize(): array
181
    {
182
        return [
183
            '@type'                        => static::TYPE_NAME,
184
            'description'                  => $this->description,
185
            'member_count'                 => $this->memberCount,
186
            'administrator_count'          => $this->administratorCount,
187
            'restricted_count'             => $this->restrictedCount,
188
            'banned_count'                 => $this->bannedCount,
189
            'linked_chat_id'               => $this->linkedChatId,
190
            'slow_mode_delay'              => $this->slowModeDelay,
191
            'slow_mode_delay_expires_in'   => $this->slowModeDelayExpiresIn,
192
            'can_get_members'              => $this->canGetMembers,
193
            'can_set_username'             => $this->canSetUsername,
194
            'can_set_sticker_set'          => $this->canSetStickerSet,
195
            'can_set_location'             => $this->canSetLocation,
196
            'can_view_statistics'          => $this->canViewStatistics,
197
            'is_all_history_available'     => $this->isAllHistoryAvailable,
198
            'sticker_set_id'               => $this->stickerSetId,
199
            'location'                     => (isset($this->location) ? $this->location : null),
200
            'invite_link'                  => $this->inviteLink,
201
            'upgraded_from_basic_group_id' => $this->upgradedFromBasicGroupId,
202
            'upgraded_from_max_message_id' => $this->upgradedFromMaxMessageId,
203
        ];
204
    }
205
206
    public function getDescription(): string
207
    {
208
        return $this->description;
209
    }
210
211
    public function getMemberCount(): int
212
    {
213
        return $this->memberCount;
214
    }
215
216
    public function getAdministratorCount(): int
217
    {
218
        return $this->administratorCount;
219
    }
220
221
    public function getRestrictedCount(): int
222
    {
223
        return $this->restrictedCount;
224
    }
225
226
    public function getBannedCount(): int
227
    {
228
        return $this->bannedCount;
229
    }
230
231
    public function getLinkedChatId(): int
232
    {
233
        return $this->linkedChatId;
234
    }
235
236
    public function getSlowModeDelay(): int
237
    {
238
        return $this->slowModeDelay;
239
    }
240
241
    public function getSlowModeDelayExpiresIn(): float
242
    {
243
        return $this->slowModeDelayExpiresIn;
244
    }
245
246
    public function getCanGetMembers(): bool
247
    {
248
        return $this->canGetMembers;
249
    }
250
251
    public function getCanSetUsername(): bool
252
    {
253
        return $this->canSetUsername;
254
    }
255
256
    public function getCanSetStickerSet(): bool
257
    {
258
        return $this->canSetStickerSet;
259
    }
260
261
    public function getCanSetLocation(): bool
262
    {
263
        return $this->canSetLocation;
264
    }
265
266
    public function getCanViewStatistics(): bool
267
    {
268
        return $this->canViewStatistics;
269
    }
270
271
    public function getIsAllHistoryAvailable(): bool
272
    {
273
        return $this->isAllHistoryAvailable;
274
    }
275
276
    public function getStickerSetId(): string
277
    {
278
        return $this->stickerSetId;
279
    }
280
281
    public function getLocation(): ?ChatLocation
282
    {
283
        return $this->location;
284
    }
285
286
    public function getInviteLink(): string
287
    {
288
        return $this->inviteLink;
289
    }
290
291
    public function getUpgradedFromBasicGroupId(): int
292
    {
293
        return $this->upgradedFromBasicGroupId;
294
    }
295
296
    public function getUpgradedFromMaxMessageId(): int
297
    {
298
        return $this->upgradedFromMaxMessageId;
299
    }
300
}
301