1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace TelegramBot\Api\Types\Inline\QueryResult; |
4
|
|
|
|
5
|
|
|
use TelegramBot\Api\Types\Inline\InlineKeyboardMarkup; |
6
|
|
|
use TelegramBot\Api\Types\Inline\InputMessageContent; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class InlineQueryResultPhoto |
10
|
|
|
* Represents a link to a photo. By default, this photo will be sent by the user with optional caption. |
11
|
|
|
* Alternatively, you can provide message_text to send it instead of photo. |
12
|
|
|
* |
13
|
|
|
* @package TelegramBot\Api\Types\Inline |
14
|
|
|
*/ |
15
|
|
|
class Photo extends AbstractInlineQueryResult |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* {@inheritdoc} |
19
|
|
|
* |
20
|
|
|
* @var array |
21
|
|
|
*/ |
22
|
|
|
static protected $requiredParams = ['type', 'id', 'photo_url', 'thumb_url']; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* {@inheritdoc} |
26
|
|
|
* |
27
|
|
|
* @var array |
28
|
|
|
*/ |
29
|
|
|
static protected $map = [ |
30
|
|
|
'type' => true, |
31
|
|
|
'id' => true, |
32
|
|
|
'photo_url' => true, |
33
|
|
|
'thumb_url' => true, |
34
|
|
|
'photo_width' => true, |
35
|
|
|
'photo_height' => true, |
36
|
|
|
'title' => true, |
37
|
|
|
'description' => true, |
38
|
|
|
'caption' => true, |
39
|
|
|
'input_message_content' => InputMessageContent::class, |
40
|
|
|
'reply_markup' => InlineKeyboardMarkup::class, |
41
|
|
|
]; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* {@inheritdoc} |
45
|
|
|
* |
46
|
|
|
* @var string |
47
|
|
|
*/ |
48
|
|
|
protected $type = 'photo'; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* A valid URL of the photo. Photo size must not exceed 5MB |
52
|
|
|
* |
53
|
|
|
* @var string |
54
|
|
|
*/ |
55
|
|
|
protected $photoUrl; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Optional. Width of the photo |
59
|
|
|
* |
60
|
|
|
* @var int |
61
|
|
|
*/ |
62
|
|
|
protected $photoWidth; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Optional. Height of the photo |
66
|
|
|
* |
67
|
|
|
* @var int |
68
|
|
|
*/ |
69
|
|
|
protected $photoHeight; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* URL of the thumbnail for the photo |
73
|
|
|
* |
74
|
|
|
* @var |
75
|
|
|
*/ |
76
|
|
|
protected $thumbUrl; |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Optional. Short description of the result |
80
|
|
|
* |
81
|
|
|
* @var string |
82
|
|
|
*/ |
83
|
|
|
protected $description; |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Optional. Caption of the photo to be sent, 0-200 characters |
87
|
|
|
* |
88
|
|
|
* @var string |
89
|
|
|
*/ |
90
|
|
|
protected $caption; |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* InlineQueryResultPhoto constructor. |
94
|
|
|
* |
95
|
|
|
* @param string $id |
96
|
|
|
* @param string $photoUrl |
97
|
|
|
* @param string $thumbUrl |
98
|
|
|
* @param int|null $photoWidth |
99
|
|
|
* @param int|null $photoHeight |
100
|
|
|
* @param string|null $title |
101
|
|
|
* @param string|null $description |
102
|
|
|
* @param string|null $caption |
103
|
|
|
* @param InputMessageContent|null $inputMessageContent |
104
|
|
|
* @param InlineKeyboardMarkup|null $inlineKeyboardMarkup |
105
|
|
|
*/ |
106
|
|
|
public function __construct( |
107
|
|
|
$id, |
108
|
|
|
$photoUrl, |
109
|
|
|
$thumbUrl, |
110
|
|
|
$photoWidth = null, |
111
|
|
|
$photoHeight = null, |
112
|
|
|
$title = null, |
113
|
|
|
$description = null, |
114
|
|
|
$caption = null, |
115
|
|
|
$inputMessageContent = null, |
116
|
|
|
$inlineKeyboardMarkup = null |
117
|
|
|
) { |
118
|
|
|
parent::__construct($id, $title, $inputMessageContent, $inlineKeyboardMarkup); |
119
|
|
|
|
120
|
|
|
$this->photoUrl = $photoUrl; |
121
|
|
|
$this->thumbUrl = $thumbUrl; |
122
|
|
|
$this->photoWidth = $photoWidth; |
123
|
|
|
$this->photoHeight = $photoHeight; |
124
|
|
|
$this->description = $description; |
125
|
|
|
$this->caption = $caption; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* @return string |
131
|
|
|
*/ |
132
|
|
|
public function getPhotoUrl() |
133
|
|
|
{ |
134
|
|
|
return $this->photoUrl; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* @param string $photoUrl |
139
|
|
|
*/ |
140
|
|
|
public function setPhotoUrl($photoUrl) |
141
|
|
|
{ |
142
|
|
|
$this->photoUrl = $photoUrl; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* @return int |
147
|
|
|
*/ |
148
|
|
|
public function getPhotoWidth() |
149
|
|
|
{ |
150
|
|
|
return $this->photoWidth; |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* @param int $photoWidth |
155
|
|
|
*/ |
156
|
|
|
public function setPhotoWidth($photoWidth) |
157
|
|
|
{ |
158
|
|
|
$this->photoWidth = $photoWidth; |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* @return int |
163
|
|
|
*/ |
164
|
|
|
public function getPhotoHeight() |
165
|
|
|
{ |
166
|
|
|
return $this->photoHeight; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* @param int $photoHeight |
171
|
|
|
*/ |
172
|
|
|
public function setPhotoHeight($photoHeight) |
173
|
|
|
{ |
174
|
|
|
$this->photoHeight = $photoHeight; |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* @return mixed |
179
|
|
|
*/ |
180
|
|
|
public function getThumbUrl() |
181
|
|
|
{ |
182
|
|
|
return $this->thumbUrl; |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* @param mixed $thumbUrl |
187
|
|
|
*/ |
188
|
|
|
public function setThumbUrl($thumbUrl) |
189
|
|
|
{ |
190
|
|
|
$this->thumbUrl = $thumbUrl; |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
/** |
194
|
|
|
* @return string |
195
|
|
|
*/ |
196
|
|
|
public function getDescription() |
197
|
|
|
{ |
198
|
|
|
return $this->description; |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
/** |
202
|
|
|
* @param string $description |
203
|
|
|
*/ |
204
|
|
|
public function setDescription($description) |
205
|
|
|
{ |
206
|
|
|
$this->description = $description; |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
/** |
210
|
|
|
* @return string |
211
|
|
|
*/ |
212
|
|
|
public function getCaption() |
213
|
|
|
{ |
214
|
|
|
return $this->caption; |
215
|
|
|
} |
216
|
|
|
|
217
|
|
|
/** |
218
|
|
|
* @param string $caption |
219
|
|
|
*/ |
220
|
|
|
public function setCaption($caption) |
221
|
|
|
{ |
222
|
|
|
$this->caption = $caption; |
223
|
|
|
} |
224
|
|
|
} |
225
|
|
|
|