|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Created by PhpStorm. |
|
4
|
|
|
* User: iGusev |
|
5
|
|
|
* Date: 14/04/16 |
|
6
|
|
|
* Time: 03:58 |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace TelegramBot\Api\Types\Inline\QueryResult; |
|
10
|
|
|
|
|
11
|
|
|
use TelegramBot\Api\Types\Inline\InlineKeyboardMarkup; |
|
12
|
|
|
use TelegramBot\Api\Types\Inline\InputMessageContent; |
|
13
|
|
|
|
|
14
|
|
|
class Contact extends AbstractInlineQueryResult |
|
15
|
|
|
{ |
|
16
|
|
|
/** |
|
17
|
|
|
* {@inheritdoc} |
|
18
|
|
|
* |
|
19
|
|
|
* @var array |
|
20
|
|
|
*/ |
|
21
|
|
|
protected static $requiredParams = ['type', 'id', 'phone_number', 'first_name']; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* {@inheritdoc} |
|
25
|
|
|
* |
|
26
|
|
|
* @var array |
|
27
|
|
|
*/ |
|
28
|
|
|
protected static $map = [ |
|
29
|
|
|
'type' => true, |
|
30
|
|
|
'id' => true, |
|
31
|
|
|
'phone_number' => true, |
|
32
|
|
|
'first_name' => true, |
|
33
|
|
|
'last_name' => true, |
|
34
|
|
|
'reply_markup' => InlineKeyboardMarkup::class, |
|
35
|
|
|
'input_message_content' => InputMessageContent::class, |
|
36
|
|
|
'thumbnail_url' => true, |
|
37
|
|
|
'thumbnail_width' => true, |
|
38
|
|
|
'thumbnail_height' => true, |
|
39
|
|
|
]; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* {@inheritdoc} |
|
43
|
|
|
* |
|
44
|
|
|
* @var string |
|
45
|
|
|
*/ |
|
46
|
|
|
protected $type = 'contact'; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* Contact's phone number |
|
50
|
|
|
* |
|
51
|
|
|
* @var string |
|
52
|
|
|
*/ |
|
53
|
|
|
protected $phoneNumber; |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* Contact's first name |
|
57
|
|
|
* |
|
58
|
|
|
* @var string |
|
59
|
|
|
*/ |
|
60
|
|
|
protected $firstName; |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* Optional. Contact's last name |
|
64
|
|
|
* |
|
65
|
|
|
* @var string|null |
|
66
|
|
|
*/ |
|
67
|
|
|
protected $lastName; |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* Optional. Url of the thumbnail for the result |
|
71
|
|
|
* |
|
72
|
|
|
* @var string|null |
|
73
|
|
|
*/ |
|
74
|
|
|
protected $thumbnailUrl; |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* Optional. Thumbnail width |
|
78
|
|
|
* |
|
79
|
|
|
* @var int|null |
|
80
|
|
|
*/ |
|
81
|
|
|
protected $thumbnailWidth; |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* Optional. Thumbnail height |
|
85
|
|
|
* |
|
86
|
|
|
* @var int|null |
|
87
|
|
|
*/ |
|
88
|
|
|
protected $thumbnailHeight; |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* Contact constructor. |
|
92
|
|
|
* |
|
93
|
|
|
* @param string $id |
|
94
|
|
|
* @param string $phoneNumber |
|
95
|
|
|
* @param string $firstName |
|
96
|
|
|
* @param string $lastName |
|
97
|
|
|
* @param string $thumbnailUrl |
|
98
|
|
|
* @param int $thumbnailWidth |
|
99
|
|
|
* @param int $thumbnailHeight |
|
100
|
|
|
* @param InputMessageContent|null $inputMessageContent |
|
101
|
|
|
* @param InlineKeyboardMarkup|null $inlineKeyboardMarkup |
|
102
|
|
|
*/ |
|
103
|
|
|
public function __construct( |
|
104
|
|
|
$id, |
|
105
|
|
|
$phoneNumber, |
|
106
|
|
|
$firstName, |
|
107
|
|
|
$lastName = null, |
|
108
|
|
|
$thumbnailUrl = null, |
|
109
|
|
|
$thumbnailWidth = null, |
|
110
|
|
|
$thumbnailHeight = null, |
|
111
|
|
|
$inputMessageContent = null, |
|
112
|
|
|
$inlineKeyboardMarkup = null |
|
113
|
|
|
) { |
|
114
|
|
|
parent::__construct($id, null, $inputMessageContent, $inlineKeyboardMarkup); |
|
115
|
|
|
|
|
116
|
|
|
$this->phoneNumber = $phoneNumber; |
|
117
|
|
|
$this->firstName = $firstName; |
|
118
|
|
|
$this->lastName = $lastName; |
|
119
|
|
|
$this->thumbnailUrl = $thumbnailUrl; |
|
120
|
|
|
$this->thumbnailWidth = $thumbnailWidth; |
|
121
|
|
|
$this->thumbnailHeight = $thumbnailHeight; |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
/** |
|
125
|
|
|
* @return string |
|
126
|
|
|
*/ |
|
127
|
|
|
public function getPhoneNumber() |
|
128
|
|
|
{ |
|
129
|
|
|
return $this->phoneNumber; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
/** |
|
133
|
|
|
* @param string $phoneNumber |
|
134
|
|
|
* |
|
135
|
|
|
* @return void |
|
136
|
|
|
*/ |
|
137
|
|
|
public function setPhoneNumber($phoneNumber) |
|
138
|
|
|
{ |
|
139
|
|
|
$this->phoneNumber = $phoneNumber; |
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
/** |
|
143
|
|
|
* @return string |
|
144
|
|
|
*/ |
|
145
|
|
|
public function getFirstName() |
|
146
|
|
|
{ |
|
147
|
|
|
return $this->firstName; |
|
148
|
|
|
} |
|
149
|
|
|
|
|
150
|
|
|
/** |
|
151
|
|
|
* @param string $firstName |
|
152
|
|
|
* |
|
153
|
|
|
* @return void |
|
154
|
|
|
*/ |
|
155
|
|
|
public function setFirstName($firstName) |
|
156
|
|
|
{ |
|
157
|
|
|
$this->firstName = $firstName; |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
/** |
|
161
|
|
|
* @return string|null |
|
162
|
|
|
*/ |
|
163
|
|
|
public function getLastName() |
|
164
|
|
|
{ |
|
165
|
|
|
return $this->lastName; |
|
166
|
|
|
} |
|
167
|
|
|
|
|
168
|
|
|
/** |
|
169
|
|
|
* @param string|null $lastName |
|
170
|
|
|
* |
|
171
|
|
|
* @return void |
|
172
|
|
|
*/ |
|
173
|
|
|
public function setLastName($lastName) |
|
174
|
|
|
{ |
|
175
|
|
|
$this->lastName = $lastName; |
|
176
|
|
|
} |
|
177
|
|
|
|
|
178
|
|
|
/** |
|
179
|
|
|
* @return string|null |
|
180
|
|
|
*/ |
|
181
|
|
|
public function getThumbnailUrl() |
|
182
|
|
|
{ |
|
183
|
|
|
return $this->thumbnailUrl; |
|
184
|
|
|
} |
|
185
|
|
|
|
|
186
|
|
|
/** |
|
187
|
|
|
* @param string|null $thumbnailUrl |
|
188
|
|
|
* |
|
189
|
|
|
* @return void |
|
190
|
|
|
*/ |
|
191
|
|
|
public function setThumbnailUrl($thumbnailUrl) |
|
192
|
|
|
{ |
|
193
|
|
|
$this->thumbnailUrl = $thumbnailUrl; |
|
194
|
|
|
} |
|
195
|
|
|
|
|
196
|
|
|
/** |
|
197
|
|
|
* @deprecated Use getThumbnailUrl |
|
198
|
|
|
* |
|
199
|
|
|
* @return string|null |
|
200
|
|
|
*/ |
|
201
|
|
|
public function getThumbUrl() |
|
202
|
|
|
{ |
|
203
|
|
|
return $this->getThumbnailUrl(); |
|
204
|
|
|
} |
|
205
|
|
|
|
|
206
|
|
|
/** |
|
207
|
|
|
* @deprecated Use setThumbnailUrl |
|
208
|
|
|
* |
|
209
|
|
|
* @param string|null $thumbUrl |
|
210
|
|
|
* |
|
211
|
|
|
* @return void |
|
212
|
|
|
*/ |
|
213
|
|
|
public function setThumbUrl($thumbUrl) |
|
214
|
|
|
{ |
|
215
|
|
|
$this->setThumbnailUrl($thumbUrl); |
|
216
|
|
|
} |
|
217
|
|
|
|
|
218
|
|
|
/** |
|
219
|
|
|
* @return int|null |
|
220
|
|
|
*/ |
|
221
|
|
|
public function getThumbnailWidth() |
|
222
|
|
|
{ |
|
223
|
|
|
return $this->thumbnailWidth; |
|
224
|
|
|
} |
|
225
|
|
|
|
|
226
|
|
|
/** |
|
227
|
|
|
* @param int|null $thumbnailWidth |
|
228
|
|
|
* |
|
229
|
|
|
* @return void |
|
230
|
|
|
*/ |
|
231
|
|
|
public function setThumbnailWidth($thumbnailWidth) |
|
232
|
|
|
{ |
|
233
|
|
|
$this->thumbnailWidth = $thumbnailWidth; |
|
234
|
|
|
} |
|
235
|
|
|
|
|
236
|
|
|
/** |
|
237
|
|
|
* @deprecated Use getThumbnailWidth |
|
238
|
|
|
* |
|
239
|
|
|
* @return int|null |
|
240
|
|
|
*/ |
|
241
|
|
|
public function getThumbWidth() |
|
242
|
|
|
{ |
|
243
|
|
|
return $this->getThumbnailWidth(); |
|
244
|
|
|
} |
|
245
|
|
|
|
|
246
|
|
|
/** |
|
247
|
|
|
* @deprecated Use setThumbnailWidth |
|
248
|
|
|
* |
|
249
|
|
|
* @param int|null $thumbWidth |
|
250
|
|
|
* |
|
251
|
|
|
* @return void |
|
252
|
|
|
*/ |
|
253
|
|
|
public function setThumbWidth($thumbWidth) |
|
254
|
|
|
{ |
|
255
|
|
|
$this->setThumbnailWidth($thumbWidth); |
|
256
|
|
|
} |
|
257
|
|
|
|
|
258
|
|
|
/** |
|
259
|
|
|
* @return int|null |
|
260
|
|
|
*/ |
|
261
|
|
|
public function getThumbnailHeight() |
|
262
|
|
|
{ |
|
263
|
|
|
return $this->thumbnailHeight; |
|
264
|
|
|
} |
|
265
|
|
|
|
|
266
|
|
|
/** |
|
267
|
|
|
* @param int|null $thumbnailHeight |
|
268
|
|
|
* |
|
269
|
|
|
* @return void |
|
270
|
|
|
*/ |
|
271
|
|
|
public function setThumbnailHeight($thumbnailHeight) |
|
272
|
|
|
{ |
|
273
|
|
|
$this->thumbnailHeight = $thumbnailHeight; |
|
274
|
|
|
} |
|
275
|
|
|
|
|
276
|
|
|
/** |
|
277
|
|
|
* @deprecated Use getThumbnailHeight |
|
278
|
|
|
* |
|
279
|
|
|
* @return int|null |
|
280
|
|
|
*/ |
|
281
|
|
|
public function getThumbHeight() |
|
282
|
|
|
{ |
|
283
|
|
|
return $this->getThumbnailHeight(); |
|
284
|
|
|
} |
|
285
|
|
|
|
|
286
|
|
|
/** |
|
287
|
|
|
* @deprecated Use setThumbnailWidth |
|
288
|
|
|
* |
|
289
|
|
|
* @param int|null $thumbHeight |
|
290
|
|
|
* |
|
291
|
|
|
* @return void |
|
292
|
|
|
*/ |
|
293
|
|
|
public function setThumbHeight($thumbHeight) |
|
294
|
|
|
{ |
|
295
|
|
|
$this->setThumbnailHeight($thumbHeight); |
|
296
|
|
|
} |
|
297
|
|
|
} |
|
298
|
|
|
|