|
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
|
|
|
static protected $requiredParams = ['type', 'id', 'phone_number', 'first_name']; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* {@inheritdoc} |
|
25
|
|
|
* |
|
26
|
|
|
* @var array |
|
27
|
|
|
*/ |
|
28
|
|
|
static protected $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
|
|
|
'thumb_url' => true, |
|
37
|
|
|
'thumb_width' => true, |
|
38
|
|
|
'thumb_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 |
|
66
|
|
|
*/ |
|
67
|
|
|
protected $lastName; |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* Optional. Url of the thumbnail for the result |
|
71
|
|
|
* |
|
72
|
|
|
* @var string |
|
73
|
|
|
*/ |
|
74
|
|
|
protected $thumbUrl; |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* Optional. Thumbnail width |
|
78
|
|
|
* |
|
79
|
|
|
* @var int |
|
80
|
|
|
*/ |
|
81
|
|
|
protected $thumbWidth; |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* Optional. Thumbnail height |
|
85
|
|
|
* |
|
86
|
|
|
* @var int |
|
87
|
|
|
*/ |
|
88
|
|
|
protected $thumbHeight; |
|
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 $thumbUrl |
|
98
|
|
|
* @param int $thumbWidth |
|
99
|
|
|
* @param int $thumbHeight |
|
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
|
|
|
$thumbUrl = null, |
|
109
|
|
|
$thumbWidth = null, |
|
110
|
|
|
$thumbHeight = 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->thumbUrl = $thumbUrl; |
|
120
|
|
|
$this->thumbWidth = $thumbWidth; |
|
121
|
|
|
$this->thumbHeight = $thumbHeight; |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
|
|
125
|
|
|
/** |
|
126
|
|
|
* @return string |
|
127
|
|
|
*/ |
|
128
|
|
|
public function getPhoneNumber() |
|
129
|
|
|
{ |
|
130
|
|
|
return $this->phoneNumber; |
|
131
|
|
|
} |
|
132
|
|
|
|
|
133
|
|
|
/** |
|
134
|
|
|
* @param string $phoneNumber |
|
135
|
|
|
*/ |
|
136
|
|
|
public function setPhoneNumber($phoneNumber) |
|
137
|
|
|
{ |
|
138
|
|
|
$this->phoneNumber = $phoneNumber; |
|
139
|
|
|
} |
|
140
|
|
|
|
|
141
|
|
|
/** |
|
142
|
|
|
* @return string |
|
143
|
|
|
*/ |
|
144
|
|
|
public function getFirstName() |
|
145
|
|
|
{ |
|
146
|
|
|
return $this->firstName; |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
/** |
|
150
|
|
|
* @param string $firstName |
|
151
|
|
|
*/ |
|
152
|
|
|
public function setFirstName($firstName) |
|
153
|
|
|
{ |
|
154
|
|
|
$this->firstName = $firstName; |
|
155
|
|
|
} |
|
156
|
|
|
|
|
157
|
|
|
/** |
|
158
|
|
|
* @return string |
|
159
|
|
|
*/ |
|
160
|
|
|
public function getLastName() |
|
161
|
|
|
{ |
|
162
|
|
|
return $this->lastName; |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
|
|
/** |
|
166
|
|
|
* @param string $lastName |
|
167
|
|
|
*/ |
|
168
|
|
|
public function setLastName($lastName) |
|
169
|
|
|
{ |
|
170
|
|
|
$this->lastName = $lastName; |
|
171
|
|
|
} |
|
172
|
|
|
|
|
173
|
|
|
/** |
|
174
|
|
|
* @return string |
|
175
|
|
|
*/ |
|
176
|
|
|
public function getThumbUrl() |
|
177
|
|
|
{ |
|
178
|
|
|
return $this->thumbUrl; |
|
179
|
|
|
} |
|
180
|
|
|
|
|
181
|
|
|
/** |
|
182
|
|
|
* @param string $thumbUrl |
|
183
|
|
|
*/ |
|
184
|
|
|
public function setThumbUrl($thumbUrl) |
|
185
|
|
|
{ |
|
186
|
|
|
$this->thumbUrl = $thumbUrl; |
|
187
|
|
|
} |
|
188
|
|
|
|
|
189
|
|
|
/** |
|
190
|
|
|
* @return int |
|
191
|
|
|
*/ |
|
192
|
|
|
public function getThumbWidth() |
|
193
|
|
|
{ |
|
194
|
|
|
return $this->thumbWidth; |
|
195
|
|
|
} |
|
196
|
|
|
|
|
197
|
|
|
/** |
|
198
|
|
|
* @param int $thumbWidth |
|
199
|
|
|
*/ |
|
200
|
|
|
public function setThumbWidth($thumbWidth) |
|
201
|
|
|
{ |
|
202
|
|
|
$this->thumbWidth = $thumbWidth; |
|
203
|
|
|
} |
|
204
|
|
|
|
|
205
|
|
|
/** |
|
206
|
|
|
* @return int |
|
207
|
|
|
*/ |
|
208
|
|
|
public function getThumbHeight() |
|
209
|
|
|
{ |
|
210
|
|
|
return $this->thumbHeight; |
|
211
|
|
|
} |
|
212
|
|
|
|
|
213
|
|
|
/** |
|
214
|
|
|
* @param int $thumbHeight |
|
215
|
|
|
*/ |
|
216
|
|
|
public function setThumbHeight($thumbHeight) |
|
217
|
|
|
{ |
|
218
|
|
|
$this->thumbHeight = $thumbHeight; |
|
219
|
|
|
} |
|
220
|
|
|
} |
|
221
|
|
|
|