MessageForwardInfo   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 25
dl 0
loc 71
rs 10
c 0
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A fromArray() 0 7 1
A getOrigin() 0 3 1
A getDate() 0 3 1
A getFromMessageId() 0 3 1
A getFromChatId() 0 3 1
A typeSerialize() 0 8 1
A __construct() 0 6 1
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
 * Contains information about a forwarded message.
13
 */
14
class MessageForwardInfo extends TdObject
15
{
16
    public const TYPE_NAME = 'messageForwardInfo';
17
18
    /**
19
     * Origin of a forwarded message.
20
     */
21
    protected MessageForwardOrigin $origin;
22
23
    /**
24
     * Point in time (Unix timestamp) when the message was originally sent.
25
     */
26
    protected int $date;
27
28
    /**
29
     * For messages forwarded to the chat with the current user (Saved Messages) or to the channel's discussion group, the identifier of the chat from which the message was forwarded last time; 0 if unknown.
30
     */
31
    protected int $fromChatId;
32
33
    /**
34
     * For messages forwarded to the chat with the current user (Saved Messages) or to the channel's discussion group, the identifier of the original message from which the new message was forwarded last time; 0 if unknown.
35
     */
36
    protected int $fromMessageId;
37
38
    public function __construct(MessageForwardOrigin $origin, int $date, int $fromChatId, int $fromMessageId)
39
    {
40
        $this->origin        = $origin;
41
        $this->date          = $date;
42
        $this->fromChatId    = $fromChatId;
43
        $this->fromMessageId = $fromMessageId;
44
    }
45
46
    public static function fromArray(array $array): MessageForwardInfo
47
    {
48
        return new static(
49
            TdSchemaRegistry::fromArray($array['origin']),
50
            $array['date'],
51
            $array['from_chat_id'],
52
            $array['from_message_id'],
53
        );
54
    }
55
56
    public function typeSerialize(): array
57
    {
58
        return [
59
            '@type'           => static::TYPE_NAME,
60
            'origin'          => $this->origin->typeSerialize(),
61
            'date'            => $this->date,
62
            'from_chat_id'    => $this->fromChatId,
63
            'from_message_id' => $this->fromMessageId,
64
        ];
65
    }
66
67
    public function getOrigin(): MessageForwardOrigin
68
    {
69
        return $this->origin;
70
    }
71
72
    public function getDate(): int
73
    {
74
        return $this->date;
75
    }
76
77
    public function getFromChatId(): int
78
    {
79
        return $this->fromChatId;
80
    }
81
82
    public function getFromMessageId(): int
83
    {
84
        return $this->fromMessageId;
85
    }
86
}
87