1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace TelegramBot\Api\Types; |
4
|
|
|
|
5
|
|
|
use TelegramBot\Api\BaseType; |
6
|
|
|
use TelegramBot\Api\TypeInterface; |
7
|
|
|
|
8
|
|
|
class ChatMemberUpdated extends BaseType implements TypeInterface |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* {@inheritdoc} |
12
|
|
|
* |
13
|
|
|
* @var array |
14
|
|
|
*/ |
15
|
|
|
protected static $requiredParams = ['chat', 'from', 'date', 'old_chat_member', 'new_chat_member']; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* {@inheritdoc} |
19
|
|
|
* |
20
|
|
|
* @var array |
21
|
|
|
*/ |
22
|
|
|
protected static $map = [ |
23
|
|
|
'chat' => Chat::class, |
24
|
|
|
'from' => User::class, |
25
|
|
|
'date' => true, |
26
|
|
|
'old_chat_member' => ChatMember::class, |
27
|
|
|
'new_chat_member' => ChatMember::class, |
28
|
|
|
'invite_link' => ChatInviteLink::class, |
29
|
|
|
'via_chat_folder_invite_link' => true, |
30
|
|
|
]; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Chat the user belongs to |
34
|
|
|
* |
35
|
|
|
* @var Chat |
36
|
|
|
*/ |
37
|
|
|
protected $chat; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Performer of the action, which resulted in the change |
41
|
|
|
* |
42
|
|
|
* @var User |
43
|
|
|
*/ |
44
|
|
|
protected $from; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Date the change was done in Unix time |
48
|
|
|
* |
49
|
|
|
* @var int |
50
|
|
|
*/ |
51
|
|
|
protected $date; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Previous information about the chat member |
55
|
|
|
* |
56
|
|
|
* @var ChatMember |
57
|
|
|
*/ |
58
|
|
|
protected $oldChatMember; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* New information about the chat member |
62
|
|
|
* |
63
|
|
|
* @var ChatMember |
64
|
|
|
*/ |
65
|
|
|
protected $newChatMember; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Optional. Chat invite link, which was used by the user to join the chat; for joining by invite link events only. |
69
|
|
|
* |
70
|
|
|
* @var ChatInviteLink|null |
71
|
|
|
*/ |
72
|
|
|
protected $inviteLink; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Optional. True, if the user joined the chat via a chat folder invite link |
76
|
|
|
* |
77
|
|
|
* @var bool|null |
78
|
|
|
*/ |
79
|
|
|
protected $viaChatFolderInviteLink; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @return Chat |
83
|
|
|
*/ |
84
|
|
|
public function getChat() |
85
|
|
|
{ |
86
|
|
|
return $this->chat; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @param Chat $chat |
91
|
|
|
* @return void |
92
|
|
|
*/ |
93
|
|
|
public function setChat($chat) |
94
|
|
|
{ |
95
|
|
|
$this->chat = $chat; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @return User |
100
|
|
|
*/ |
101
|
|
|
public function getFrom() |
102
|
|
|
{ |
103
|
|
|
return $this->from; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @param User $from |
108
|
|
|
* @return void |
109
|
|
|
*/ |
110
|
|
|
public function setFrom($from) |
111
|
|
|
{ |
112
|
|
|
$this->from = $from; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @return int |
117
|
|
|
*/ |
118
|
|
|
public function getDate() |
119
|
|
|
{ |
120
|
|
|
return $this->date; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* @param int $date |
125
|
|
|
* @return void |
126
|
|
|
*/ |
127
|
|
|
public function setDate($date) |
128
|
|
|
{ |
129
|
|
|
$this->date = $date; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @return ChatMember |
134
|
|
|
*/ |
135
|
|
|
public function getOldChatMember() |
136
|
|
|
{ |
137
|
|
|
return $this->oldChatMember; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @param ChatMember $oldChatMember |
142
|
|
|
* @return void |
143
|
|
|
*/ |
144
|
|
|
public function setOldChatMember($oldChatMember) |
145
|
|
|
{ |
146
|
|
|
$this->oldChatMember = $oldChatMember; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* @return ChatMember |
151
|
|
|
*/ |
152
|
|
|
public function getNewChatMember() |
153
|
|
|
{ |
154
|
|
|
return $this->newChatMember; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* @param ChatMember $newChatMember |
159
|
|
|
* @return void |
160
|
|
|
*/ |
161
|
|
|
public function setNewChatMember($newChatMember) |
162
|
|
|
{ |
163
|
|
|
$this->newChatMember = $newChatMember; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* @return ChatInviteLink|null |
168
|
|
|
*/ |
169
|
|
|
public function getInviteLink() |
170
|
|
|
{ |
171
|
|
|
return $this->inviteLink; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* @param ChatInviteLink|null $inviteLink |
176
|
|
|
* @return void |
177
|
|
|
*/ |
178
|
|
|
public function setInviteLink($inviteLink) |
179
|
|
|
{ |
180
|
|
|
$this->inviteLink = $inviteLink; |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
/** |
184
|
|
|
* @return bool|null |
185
|
|
|
*/ |
186
|
|
|
public function getViaChatFolderInviteLink() |
187
|
|
|
{ |
188
|
|
|
return $this->viaChatFolderInviteLink; |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
/** |
192
|
|
|
* @param bool|null $viaChatFolderInviteLink |
193
|
|
|
* @return void |
194
|
|
|
*/ |
195
|
|
|
public function setViaChatFolderInviteLink($viaChatFolderInviteLink) |
196
|
|
|
{ |
197
|
|
|
$this->viaChatFolderInviteLink = $viaChatFolderInviteLink; |
198
|
|
|
} |
199
|
|
|
} |
200
|
|
|
|