UpdateUnreadMessageCount::getUnreadUnmutedCount()   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
 * Number of unread messages in a chat list has changed. This update is sent only if the message database is used.
13
 */
14
class UpdateUnreadMessageCount extends Update
15
{
16
    public const TYPE_NAME = 'updateUnreadMessageCount';
17
18
    /**
19
     * The chat list with changed number of unread messages.
20
     */
21
    protected ChatList $chatList;
22
23
    /**
24
     * Total number of unread messages.
25
     */
26
    protected int $unreadCount;
27
28
    /**
29
     * Total number of unread messages in unmuted chats.
30
     */
31
    protected int $unreadUnmutedCount;
32
33
    public function __construct(ChatList $chatList, int $unreadCount, int $unreadUnmutedCount)
34
    {
35
        parent::__construct();
36
37
        $this->chatList           = $chatList;
38
        $this->unreadCount        = $unreadCount;
39
        $this->unreadUnmutedCount = $unreadUnmutedCount;
40
    }
41
42
    public static function fromArray(array $array): UpdateUnreadMessageCount
43
    {
44
        return new static(
45
            TdSchemaRegistry::fromArray($array['chat_list']),
46
            $array['unread_count'],
47
            $array['unread_unmuted_count'],
48
        );
49
    }
50
51
    public function typeSerialize(): array
52
    {
53
        return [
54
            '@type'                => static::TYPE_NAME,
55
            'chat_list'            => $this->chatList->typeSerialize(),
56
            'unread_count'         => $this->unreadCount,
57
            'unread_unmuted_count' => $this->unreadUnmutedCount,
58
        ];
59
    }
60
61
    public function getChatList(): ChatList
62
    {
63
        return $this->chatList;
64
    }
65
66
    public function getUnreadCount(): int
67
    {
68
        return $this->unreadCount;
69
    }
70
71
    public function getUnreadUnmutedCount(): int
72
    {
73
        return $this->unreadUnmutedCount;
74
    }
75
}
76