CallbackQuery::getFrom()   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
declare(strict_types=1);
4
5
namespace Zanzara\Telegram\Type;
6
7
/**
8
 * This object represents an incoming callback query from a callback button in an inline keyboard. If the button that
9
 * originated the query was attached to a message sent by the bot, the field message will be present. If the button
10
 * was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly
11
 * one of the fields data or game_short_name will be present.
12
 *
13
 * More on https://core.telegram.org/bots/api#callbackquery
14
 */
15
class CallbackQuery
16
{
17
18
    /**
19
     * Unique identifier for this query
20
     *
21
     * @var string
22
     */
23
    private $id;
24
25
    /**
26
     * Sender
27
     *
28
     * @var User
29
     */
30
    private $from;
31
32
    /**
33
     * Optional. Message with the callback button that originated the query. Note that message content and message date will
34
     * not be available if the message is too old
35
     *
36
     * @var Message|null
37
     */
38
    private $message;
39
40
    /**
41
     * Optional. Identifier of the message sent via the bot in inline mode, that originated the query.
42
     *
43
     * @var string|null
44
     */
45
    private $inline_message_id;
46
47
    /**
48
     * Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful
49
     * for high scores in games.
50
     *
51
     * @var string
52
     */
53
    private $chat_instance;
54
55
    /**
56
     * Optional. Data associated with the callback button. Be aware that a bad client can send arbitrary data in this field.
57
     *
58
     * @var string|null
59
     */
60
    private $data;
61
62
    /**
63
     * Optional. Short name of a Game to be returned, serves as the unique identifier for the game
64
     *
65
     * @var string|null
66
     */
67
    private $game_short_name;
68
69
    /**
70
     * @return string
71
     */
72
    public function getId(): string
73
    {
74
        return $this->id;
75
    }
76
77
    /**
78
     * @param string $id
79
     */
80
    public function setId(string $id): void
81
    {
82
        $this->id = $id;
83
    }
84
85
    /**
86
     * @return User
87
     */
88
    public function getFrom(): User
89
    {
90
        return $this->from;
91
    }
92
93
    /**
94
     * @param User $from
95
     */
96
    public function setFrom(User $from): void
97
    {
98
        $this->from = $from;
99
    }
100
101
    /**
102
     * @return Message|null
103
     */
104
    public function getMessage(): ?Message
105
    {
106
        return $this->message;
107
    }
108
109
    /**
110
     * @param Message|null $message
111
     */
112
    public function setMessage(?Message $message): void
113
    {
114
        $this->message = $message;
115
    }
116
117
    /**
118
     * @return string|null
119
     */
120
    public function getInlineMessageId(): ?string
121
    {
122
        return $this->inline_message_id;
123
    }
124
125
    /**
126
     * @param string|null $inline_message_id
127
     */
128
    public function setInlineMessageId(?string $inline_message_id): void
129
    {
130
        $this->inline_message_id = $inline_message_id;
131
    }
132
133
    /**
134
     * @return string
135
     */
136
    public function getChatInstance(): string
137
    {
138
        return $this->chat_instance;
139
    }
140
141
    /**
142
     * @param string $chat_instance
143
     */
144
    public function setChatInstance(string $chat_instance): void
145
    {
146
        $this->chat_instance = $chat_instance;
147
    }
148
149
    /**
150
     * @return string|null
151
     */
152
    public function getData(): ?string
153
    {
154
        return $this->data;
155
    }
156
157
    /**
158
     * @param string|null $data
159
     */
160
    public function setData(?string $data): void
161
    {
162
        $this->data = $data;
163
    }
164
165
    /**
166
     * @return string|null
167
     */
168
    public function getGameShortName(): ?string
169
    {
170
        return $this->game_short_name;
171
    }
172
173
    /**
174
     * @param string|null $game_short_name
175
     */
176
    public function setGameShortName(?string $game_short_name): void
177
    {
178
        $this->game_short_name = $game_short_name;
179
    }
180
181
}