SendMessageAlbum::getChatId()   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 AurimasNiekis\TdLibSchema;
10
11
/**
12
 * Sends messages grouped together into an album. Currently only photo and video messages can be grouped into an album. Returns sent messages.
13
 */
14
class SendMessageAlbum extends TdFunction
15
{
16
    public const TYPE_NAME = 'sendMessageAlbum';
17
18
    /**
19
     * Target chat.
20
     *
21
     * @var int
22
     */
23
    protected int $chatId;
24
25
    /**
26
     * Identifier of a message to reply to or 0.
27
     *
28
     * @var int
29
     */
30
    protected int $replyToMessageId;
31
32
    /**
33
     * Options to be used to send the messages.
34
     *
35
     * @var SendMessageOptions
36
     */
37
    protected SendMessageOptions $options;
38
39
    /**
40
     * Contents of messages to be sent.
41
     *
42
     * @var InputMessageContent[]
43
     */
44
    protected array $inputMessageContents;
45
46
    public function __construct(int $chatId, int $replyToMessageId, SendMessageOptions $options, array $inputMessageContents)
47
    {
48
        $this->chatId               = $chatId;
49
        $this->replyToMessageId     = $replyToMessageId;
50
        $this->options              = $options;
51
        $this->inputMessageContents = $inputMessageContents;
52
    }
53
54
    public static function fromArray(array $array): SendMessageAlbum
55
    {
56
        return new static(
57
            $array['chat_id'],
58
            $array['reply_to_message_id'],
59
            TdSchemaRegistry::fromArray($array['options']),
60
            array_map(fn ($x) => TdSchemaRegistry::fromArray($x), $array['inputMessageContents']),
61
        );
62
    }
63
64
    public function typeSerialize(): array
65
    {
66
        return [
67
            '@type'               => static::TYPE_NAME,
68
            'chat_id'             => $this->chatId,
69
            'reply_to_message_id' => $this->replyToMessageId,
70
            'options'             => $this->options->typeSerialize(),
71
            array_map(fn ($x)     => $x->typeSerialize(), $this->inputMessageContents),
72
        ];
73
    }
74
75
    public function getChatId(): int
76
    {
77
        return $this->chatId;
78
    }
79
80
    public function getReplyToMessageId(): int
81
    {
82
        return $this->replyToMessageId;
83
    }
84
85
    public function getOptions(): SendMessageOptions
86
    {
87
        return $this->options;
88
    }
89
90
    public function getInputMessageContents(): array
91
    {
92
        return $this->inputMessageContents;
93
    }
94
}
95