UpdateNewInlineCallbackQuery   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 96
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 31
dl 0
loc 96
rs 10
c 0
b 0
f 0
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A fromArray() 0 8 1
A getInlineMessageId() 0 3 1
A __construct() 0 9 1
A typeSerialize() 0 9 1
A getId() 0 3 1
A getSenderUserId() 0 3 1
A getPayload() 0 3 1
A getChatInstance() 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
 * A new incoming callback query from a message sent via a bot; for bots only.
13
 */
14
class UpdateNewInlineCallbackQuery extends Update
15
{
16
    public const TYPE_NAME = 'updateNewInlineCallbackQuery';
17
18
    /**
19
     * Unique query identifier.
20
     *
21
     * @var string
22
     */
23
    protected string $id;
24
25
    /**
26
     * Identifier of the user who sent the query.
27
     *
28
     * @var int
29
     */
30
    protected int $senderUserId;
31
32
    /**
33
     * Identifier of the inline message, from which the query originated.
34
     *
35
     * @var string
36
     */
37
    protected string $inlineMessageId;
38
39
    /**
40
     * An identifier uniquely corresponding to the chat a message was sent to.
41
     *
42
     * @var string
43
     */
44
    protected string $chatInstance;
45
46
    /**
47
     * Query payload.
48
     *
49
     * @var CallbackQueryPayload
50
     */
51
    protected CallbackQueryPayload $payload;
52
53
    public function __construct(string $id, int $senderUserId, string $inlineMessageId, string $chatInstance, CallbackQueryPayload $payload)
54
    {
55
        parent::__construct();
56
57
        $this->id              = $id;
58
        $this->senderUserId    = $senderUserId;
59
        $this->inlineMessageId = $inlineMessageId;
60
        $this->chatInstance    = $chatInstance;
61
        $this->payload         = $payload;
62
    }
63
64
    public static function fromArray(array $array): UpdateNewInlineCallbackQuery
65
    {
66
        return new static(
67
            $array['id'],
68
            $array['sender_user_id'],
69
            $array['inline_message_id'],
70
            $array['chat_instance'],
71
            TdSchemaRegistry::fromArray($array['payload']),
72
        );
73
    }
74
75
    public function typeSerialize(): array
76
    {
77
        return [
78
            '@type'             => static::TYPE_NAME,
79
            'id'                => $this->id,
80
            'sender_user_id'    => $this->senderUserId,
81
            'inline_message_id' => $this->inlineMessageId,
82
            'chat_instance'     => $this->chatInstance,
83
            'payload'           => $this->payload->typeSerialize(),
84
        ];
85
    }
86
87
    public function getId(): string
88
    {
89
        return $this->id;
90
    }
91
92
    public function getSenderUserId(): int
93
    {
94
        return $this->senderUserId;
95
    }
96
97
    public function getInlineMessageId(): string
98
    {
99
        return $this->inlineMessageId;
100
    }
101
102
    public function getChatInstance(): string
103
    {
104
        return $this->chatInstance;
105
    }
106
107
    public function getPayload(): CallbackQueryPayload
108
    {
109
        return $this->payload;
110
    }
111
}
112