UpdateChatReadInbox   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 getUnreadCount() 0 3 1
A typeSerialize() 0 7 1
A getChatId() 0 3 1
A __construct() 0 7 1
A fromArray() 0 6 1
A getLastReadInboxMessageId() 0 3 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
 * Incoming messages were read or number of unread messages has been changed.
13
 */
14
class UpdateChatReadInbox extends Update
15
{
16
    public const TYPE_NAME = 'updateChatReadInbox';
17
18
    /**
19
     * Chat identifier.
20
     *
21
     * @var int
22
     */
23
    protected int $chatId;
24
25
    /**
26
     * Identifier of the last read incoming message.
27
     *
28
     * @var int
29
     */
30
    protected int $lastReadInboxMessageId;
31
32
    /**
33
     * The number of unread messages left in the chat.
34
     *
35
     * @var int
36
     */
37
    protected int $unreadCount;
38
39
    public function __construct(int $chatId, int $lastReadInboxMessageId, int $unreadCount)
40
    {
41
        parent::__construct();
42
43
        $this->chatId                 = $chatId;
44
        $this->lastReadInboxMessageId = $lastReadInboxMessageId;
45
        $this->unreadCount            = $unreadCount;
46
    }
47
48
    public static function fromArray(array $array): UpdateChatReadInbox
49
    {
50
        return new static(
51
            $array['chat_id'],
52
            $array['last_read_inbox_message_id'],
53
            $array['unread_count'],
54
        );
55
    }
56
57
    public function typeSerialize(): array
58
    {
59
        return [
60
            '@type'                      => static::TYPE_NAME,
61
            'chat_id'                    => $this->chatId,
62
            'last_read_inbox_message_id' => $this->lastReadInboxMessageId,
63
            'unread_count'               => $this->unreadCount,
64
        ];
65
    }
66
67
    public function getChatId(): int
68
    {
69
        return $this->chatId;
70
    }
71
72
    public function getLastReadInboxMessageId(): int
73
    {
74
        return $this->lastReadInboxMessageId;
75
    }
76
77
    public function getUnreadCount(): int
78
    {
79
        return $this->unreadCount;
80
    }
81
}
82