typeSerialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 7
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 AurimasNiekis\TdLibSchema;
10
11
/**
12
 * Contains statistics about interactions with a message.
13
 */
14
class ChatStatisticsMessageInteractionCounters extends TdObject
15
{
16
    public const TYPE_NAME = 'chatStatisticsMessageInteractionCounters';
17
18
    /**
19
     * Message identifier.
20
     *
21
     * @var int
22
     */
23
    protected int $messageId;
24
25
    /**
26
     * Number of times the message was viewed.
27
     *
28
     * @var int
29
     */
30
    protected int $viewCount;
31
32
    /**
33
     * Number of times the message was forwarded.
34
     *
35
     * @var int
36
     */
37
    protected int $forwardCount;
38
39
    public function __construct(int $messageId, int $viewCount, int $forwardCount)
40
    {
41
        $this->messageId    = $messageId;
42
        $this->viewCount    = $viewCount;
43
        $this->forwardCount = $forwardCount;
44
    }
45
46
    public static function fromArray(array $array): ChatStatisticsMessageInteractionCounters
47
    {
48
        return new static(
49
            $array['message_id'],
50
            $array['view_count'],
51
            $array['forward_count'],
52
        );
53
    }
54
55
    public function typeSerialize(): array
56
    {
57
        return [
58
            '@type'         => static::TYPE_NAME,
59
            'message_id'    => $this->messageId,
60
            'view_count'    => $this->viewCount,
61
            'forward_count' => $this->forwardCount,
62
        ];
63
    }
64
65
    public function getMessageId(): int
66
    {
67
        return $this->messageId;
68
    }
69
70
    public function getViewCount(): int
71
    {
72
        return $this->viewCount;
73
    }
74
75
    public function getForwardCount(): int
76
    {
77
        return $this->forwardCount;
78
    }
79
}
80