PushMessageContentChatAddMembers   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 21
dl 0
loc 66
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A fromArray() 0 6 1
A getMemberName() 0 3 1
A __construct() 0 7 1
A getIsCurrentUser() 0 3 1
A getIsReturned() 0 3 1
A typeSerialize() 0 7 1
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
 * New chat members were invited to a group.
13
 */
14
class PushMessageContentChatAddMembers extends PushMessageContent
15
{
16
    public const TYPE_NAME = 'pushMessageContentChatAddMembers';
17
18
    /**
19
     * Name of the added member.
20
     *
21
     * @var string
22
     */
23
    protected string $memberName;
24
25
    /**
26
     * True, if the current user was added to the group.
27
     *
28
     * @var bool
29
     */
30
    protected bool $isCurrentUser;
31
32
    /**
33
     * True, if the user has returned to the group themself.
34
     *
35
     * @var bool
36
     */
37
    protected bool $isReturned;
38
39
    public function __construct(string $memberName, bool $isCurrentUser, bool $isReturned)
40
    {
41
        parent::__construct();
42
43
        $this->memberName    = $memberName;
44
        $this->isCurrentUser = $isCurrentUser;
45
        $this->isReturned    = $isReturned;
46
    }
47
48
    public static function fromArray(array $array): PushMessageContentChatAddMembers
49
    {
50
        return new static(
51
            $array['member_name'],
52
            $array['is_current_user'],
53
            $array['is_returned'],
54
        );
55
    }
56
57
    public function typeSerialize(): array
58
    {
59
        return [
60
            '@type'           => static::TYPE_NAME,
61
            'member_name'     => $this->memberName,
62
            'is_current_user' => $this->isCurrentUser,
63
            'is_returned'     => $this->isReturned,
64
        ];
65
    }
66
67
    public function getMemberName(): string
68
    {
69
        return $this->memberName;
70
    }
71
72
    public function getIsCurrentUser(): bool
73
    {
74
        return $this->isCurrentUser;
75
    }
76
77
    public function getIsReturned(): bool
78
    {
79
        return $this->isReturned;
80
    }
81
}
82