-
Notifications
You must be signed in to change notification settings - Fork 323
/
User.php
250 lines (210 loc) · 5.22 KB
/
User.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
<?php
namespace TelegramBot\Api\Types;
use TelegramBot\Api\BaseType;
use TelegramBot\Api\InvalidArgumentException;
use TelegramBot\Api\TypeInterface;
/**
* Class User
* This object represents a Telegram user or bot.
*
* @package TelegramBot\Api\Types
*/
class User extends BaseType implements TypeInterface
{
/**
* {@inheritdoc}
*
* @var array
*/
protected static $requiredParams = ['id', 'first_name'];
/**
* {@inheritdoc}
*
* @var array
*/
protected static $map = [
'id' => true,
'first_name' => true,
'last_name' => true,
'username' => true,
'language_code' => true,
'is_bot' => true,
'is_premium' => true,
'added_to_attachment_menu' => true,
'can_join_groups' => true,
'can_read_all_group_messages' => true,
'supports_inline_queries' => true,
'can_connect_to_business' => true
];
/**
* Unique identifier for this user or bot
*
* @var int|float
*/
protected $id;
/**
* User‘s or bot’s first name
*
* @var string
*/
protected $firstName;
/**
* Optional. User‘s or bot’s last name
*
* @var string|null
*/
protected $lastName;
/**
* Optional. User‘s or bot’s username
*
* @var string|null
*/
protected $username;
/**
* Optional. IETF language tag of the user's language
*
* @var string|null
*/
protected $languageCode;
/**
* True, if this user is a bot
*
* @var bool
*/
protected $isBot;
/**
* Optional. True, if this user is a Telegram Premium user
*
* @var bool|null
*/
protected $isPremium;
/**
* Optional. True, if this user added the bot to the attachment menu
*
* @var bool|null
*/
protected $addedToAttachmentMenu;
/**
* Optional. True, if the bot can be invited to groups. Returned only in getMe.
*
* @var bool|null
*/
protected $canJoinGroups;
/**
* Optional. True, if privacy mode is disabled for the bot. Returned only in getMe.
*
* @var bool|null
*/
protected $canReadAllGroupMessages;
/**
* Optional. True, if the bot supports inline queries. Returned only in getMe.
*
* @var bool|null
*/
protected $supportsInlineQueries;
/**
* Optional. True, if the bot can be connected to a Telegram Business account to receive its messages. Returned only in getMe.
*
* @var bool|null
*/
protected $canConnectToBusiness;
public function getId(): int|float
{
return $this->id;
}
public function setId($id): void
{
if (!is_int($id) && !is_float($id)) {
throw new InvalidArgumentException('ID must be an integer or float');
}
$this->id = $id;
}
public function getFirstName(): string
{
return $this->firstName;
}
public function setFirstName($firstName): void
{
$this->firstName = $firstName;
}
public function getLastName(): ?string
{
return $this->lastName;
}
public function setLastName($lastName): void
{
$this->lastName = $lastName;
}
public function getUsername(): ?string
{
return $this->username;
}
public function setUsername($username): void
{
$this->username = $username;
}
public function getLanguageCode()
{
return $this->languageCode;
}
public function setLanguageCode($languageCode): void
{
$this->languageCode = $languageCode;
}
public function isBot(): bool
{
return (bool) $this->isBot;
}
public function setIsBot($isBot): void
{
$this->isBot = $isBot;
}
public function getIsPremium(): ?bool
{
return $this->isPremium;
}
public function setIsPremium($isPremium): void
{
$this->isPremium = $isPremium;
}
public function getAddedToAttachmentMenu(): ?bool
{
return $this->addedToAttachmentMenu;
}
public function setAddedToAttachmentMenu($addedToAttachmentMenu): void
{
$this->addedToAttachmentMenu = $addedToAttachmentMenu;
}
public function getCanJoinGroups(): ?bool
{
return $this->canJoinGroups;
}
public function setCanJoinGroups($canJoinGroups): void
{
$this->canJoinGroups = $canJoinGroups;
}
public function getCanReadAllGroupMessages(): ?bool
{
return $this->canReadAllGroupMessages;
}
public function setCanReadAllGroupMessages($canReadAllGroupMessages): void
{
$this->canReadAllGroupMessages = $canReadAllGroupMessages;
}
public function getSupportsInlineQueries(): ?bool
{
return $this->supportsInlineQueries;
}
public function setSupportsInlineQueries($supportsInlineQueries): void
{
$this->supportsInlineQueries = $supportsInlineQueries;
}
public function getCanConnectToBusiness(): ?bool
{
return $this->canConnectToBusiness;
}
public function setCanConnectToBusiness($canConnectToBusiness): void
{
$this->canConnectToBusiness = $canConnectToBusiness;
}
}