AddChatMembers::typeSerialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
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
 * Adds multiple new members to a chat. Currently this option is only available for supergroups and channels. This option can't be used to join a chat. Members can't be added to a channel if it has more than 200 members. Members will not be added until the chat state has been synchronized with the server.
13
 */
14
class AddChatMembers extends TdFunction
15
{
16
    public const TYPE_NAME = 'addChatMembers';
17
18
    /**
19
     * Chat identifier.
20
     */
21
    protected int $chatId;
22
23
    /**
24
     * Identifiers of the users to be added to the chat.
25
     *
26
     * @var int[]
27
     */
28
    protected array $userIds;
29
30
    public function __construct(int $chatId, array $userIds)
31
    {
32
        $this->chatId  = $chatId;
33
        $this->userIds = $userIds;
34
    }
35
36
    public static function fromArray(array $array): AddChatMembers
37
    {
38
        return new static(
39
            $array['chat_id'],
40
            $array['user_ids'],
41
        );
42
    }
43
44
    public function typeSerialize(): array
45
    {
46
        return [
47
            '@type'    => static::TYPE_NAME,
48
            'chat_id'  => $this->chatId,
49
            'user_ids' => $this->userIds,
50
        ];
51
    }
52
53
    public function getChatId(): int
54
    {
55
        return $this->chatId;
56
    }
57
58
    public function getUserIds(): array
59
    {
60
        return $this->userIds;
61
    }
62
}
63