UpdateUnreadChatCount   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 117
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 36
dl 0
loc 117
rs 10
c 0
b 0
f 0
wmc 9

9 Methods

Rating   Name   Duplication   Size   Complexity  
A getMarkedAsUnreadUnmutedCount() 0 3 1
A __construct() 0 16 1
A fromArray() 0 9 1
A getUnreadCount() 0 3 1
A getUnreadUnmutedCount() 0 3 1
A getChatList() 0 3 1
A getMarkedAsUnreadCount() 0 3 1
A getTotalCount() 0 3 1
A typeSerialize() 0 10 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
 * Number of unread chats, i.e. with unread messages or marked as unread, has changed. This update is sent only if the message database is used.
13
 */
14
class UpdateUnreadChatCount extends Update
15
{
16
    public const TYPE_NAME = 'updateUnreadChatCount';
17
18
    /**
19
     * The chat list with changed number of unread messages.
20
     *
21
     * @var ChatList
22
     */
23
    protected ChatList $chatList;
24
25
    /**
26
     * Approximate total number of chats in the chat list.
27
     *
28
     * @var int
29
     */
30
    protected int $totalCount;
31
32
    /**
33
     * Total number of unread chats.
34
     *
35
     * @var int
36
     */
37
    protected int $unreadCount;
38
39
    /**
40
     * Total number of unread unmuted chats.
41
     *
42
     * @var int
43
     */
44
    protected int $unreadUnmutedCount;
45
46
    /**
47
     * Total number of chats marked as unread.
48
     *
49
     * @var int
50
     */
51
    protected int $markedAsUnreadCount;
52
53
    /**
54
     * Total number of unmuted chats marked as unread.
55
     *
56
     * @var int
57
     */
58
    protected int $markedAsUnreadUnmutedCount;
59
60
    public function __construct(
61
        ChatList $chatList,
62
        int $totalCount,
63
        int $unreadCount,
64
        int $unreadUnmutedCount,
65
        int $markedAsUnreadCount,
66
        int $markedAsUnreadUnmutedCount
67
    ) {
68
        parent::__construct();
69
70
        $this->chatList                   = $chatList;
71
        $this->totalCount                 = $totalCount;
72
        $this->unreadCount                = $unreadCount;
73
        $this->unreadUnmutedCount         = $unreadUnmutedCount;
74
        $this->markedAsUnreadCount        = $markedAsUnreadCount;
75
        $this->markedAsUnreadUnmutedCount = $markedAsUnreadUnmutedCount;
76
    }
77
78
    public static function fromArray(array $array): UpdateUnreadChatCount
79
    {
80
        return new static(
81
            TdSchemaRegistry::fromArray($array['chat_list']),
82
            $array['total_count'],
83
            $array['unread_count'],
84
            $array['unread_unmuted_count'],
85
            $array['marked_as_unread_count'],
86
            $array['marked_as_unread_unmuted_count'],
87
        );
88
    }
89
90
    public function typeSerialize(): array
91
    {
92
        return [
93
            '@type'                          => static::TYPE_NAME,
94
            'chat_list'                      => $this->chatList->typeSerialize(),
95
            'total_count'                    => $this->totalCount,
96
            'unread_count'                   => $this->unreadCount,
97
            'unread_unmuted_count'           => $this->unreadUnmutedCount,
98
            'marked_as_unread_count'         => $this->markedAsUnreadCount,
99
            'marked_as_unread_unmuted_count' => $this->markedAsUnreadUnmutedCount,
100
        ];
101
    }
102
103
    public function getChatList(): ChatList
104
    {
105
        return $this->chatList;
106
    }
107
108
    public function getTotalCount(): int
109
    {
110
        return $this->totalCount;
111
    }
112
113
    public function getUnreadCount(): int
114
    {
115
        return $this->unreadCount;
116
    }
117
118
    public function getUnreadUnmutedCount(): int
119
    {
120
        return $this->unreadUnmutedCount;
121
    }
122
123
    public function getMarkedAsUnreadCount(): int
124
    {
125
        return $this->markedAsUnreadCount;
126
    }
127
128
    public function getMarkedAsUnreadUnmutedCount(): int
129
    {
130
        return $this->markedAsUnreadUnmutedCount;
131
    }
132
}
133