EditMessageCaption   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Importance

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

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getChatId() 0 3 1
A fromArray() 0 7 1
A __construct() 0 6 1
A typeSerialize() 0 8 1
A getMessageId() 0 3 1
A getReplyMarkup() 0 3 1
A getCaption() 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
 * Edits the message content caption. Returns the edited message after the edit is completed on the server side.
13
 */
14
class EditMessageCaption extends TdFunction
15
{
16
    public const TYPE_NAME = 'editMessageCaption';
17
18
    /**
19
     * The chat the message belongs to.
20
     *
21
     * @var int
22
     */
23
    protected int $chatId;
24
25
    /**
26
     * Identifier of the message.
27
     *
28
     * @var int
29
     */
30
    protected int $messageId;
31
32
    /**
33
     * The new message reply markup; for bots only.
34
     *
35
     * @var ReplyMarkup
36
     */
37
    protected ReplyMarkup $replyMarkup;
38
39
    /**
40
     * New message content caption; 0-GetOption("message_caption_length_max") characters.
41
     *
42
     * @var FormattedText
43
     */
44
    protected FormattedText $caption;
45
46
    public function __construct(int $chatId, int $messageId, ReplyMarkup $replyMarkup, FormattedText $caption)
47
    {
48
        $this->chatId      = $chatId;
49
        $this->messageId   = $messageId;
50
        $this->replyMarkup = $replyMarkup;
51
        $this->caption     = $caption;
52
    }
53
54
    public static function fromArray(array $array): EditMessageCaption
55
    {
56
        return new static(
57
            $array['chat_id'],
58
            $array['message_id'],
59
            TdSchemaRegistry::fromArray($array['reply_markup']),
60
            TdSchemaRegistry::fromArray($array['caption']),
61
        );
62
    }
63
64
    public function typeSerialize(): array
65
    {
66
        return [
67
            '@type'        => static::TYPE_NAME,
68
            'chat_id'      => $this->chatId,
69
            'message_id'   => $this->messageId,
70
            'reply_markup' => $this->replyMarkup->typeSerialize(),
71
            'caption'      => $this->caption->typeSerialize(),
72
        ];
73
    }
74
75
    public function getChatId(): int
76
    {
77
        return $this->chatId;
78
    }
79
80
    public function getMessageId(): int
81
    {
82
        return $this->messageId;
83
    }
84
85
    public function getReplyMarkup(): ReplyMarkup
86
    {
87
        return $this->replyMarkup;
88
    }
89
90
    public function getCaption(): FormattedText
91
    {
92
        return $this->caption;
93
    }
94
}
95