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
|
|
|
'mime_type' => true, |
34
|
|
|
'photo_width' => true, |
35
|
|
|
'photo_height' => true, |
36
|
|
|
'thumb_url' => true, |
37
|
|
|
'title' => true, |
38
|
|
|
'description' => true, |
39
|
|
|
'caption' => true, |
40
|
|
|
'message_text' => true, |
41
|
|
|
'parse_mode' => true, |
42
|
|
|
'disable_web_page_preview' => true, |
43
|
|
|
]; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* {@inheritdoc} |
47
|
|
|
* |
48
|
|
|
* @var string |
49
|
|
|
*/ |
50
|
|
|
protected $type = 'photo'; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* A valid URL of the photo. Photo size must not exceed 5MB |
54
|
|
|
* |
55
|
|
|
* @var string |
56
|
|
|
*/ |
57
|
|
|
protected $photoUrl; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Optional. Width of the photo |
61
|
|
|
* |
62
|
|
|
* @var int |
63
|
|
|
*/ |
64
|
|
|
protected $photoWidth; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Optional. Height of the photo |
68
|
|
|
* |
69
|
|
|
* @var int |
70
|
|
|
*/ |
71
|
|
|
protected $photoHeight; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* URL of the thumbnail for the photo |
75
|
|
|
* |
76
|
|
|
* @var |
77
|
|
|
*/ |
78
|
|
|
protected $thumbUrl; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Optional. Short description of the result |
82
|
|
|
* |
83
|
|
|
* @var string |
84
|
|
|
*/ |
85
|
|
|
protected $description; |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Optional. Caption of the photo to be sent, 0-200 characters |
89
|
|
|
* |
90
|
|
|
* @var string |
91
|
|
|
*/ |
92
|
|
|
protected $caption; |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* InlineQueryResultPhoto constructor. |
96
|
|
|
* |
97
|
|
|
* @param string $id |
98
|
|
|
* @param string $photoUrl |
99
|
|
|
* @param string $thumbUrl |
100
|
|
|
* @param int|null $photoWidth |
101
|
|
|
* @param int|null $photoHeight |
102
|
|
|
* @param string|null $title |
103
|
|
|
* @param string|null $description |
104
|
|
|
* @param string|null $caption |
105
|
|
|
* @param InputMessageContent|null $inputMessageContent |
106
|
|
|
* @param InlineKeyboardMarkup|null $inlineKeyboardMarkup |
107
|
|
|
*/ |
108
|
|
|
public function __construct( |
109
|
|
|
$id, |
110
|
|
|
$photoUrl, |
111
|
|
|
$thumbUrl, |
112
|
|
|
$photoWidth = null, |
113
|
|
|
$photoHeight = null, |
114
|
|
|
$title = null, |
115
|
|
|
$description = null, |
116
|
|
|
$caption = null, |
117
|
|
|
$inputMessageContent = null, |
118
|
|
|
$inlineKeyboardMarkup = null |
119
|
|
|
) { |
120
|
|
|
parent::__construct($id, $title, $inputMessageContent, $inlineKeyboardMarkup); |
121
|
|
|
|
122
|
|
|
$this->photoUrl = $photoUrl; |
123
|
|
|
$this->thumbUrl = $thumbUrl; |
124
|
|
|
$this->photoWidth = $photoWidth; |
125
|
|
|
$this->photoHeight = $photoHeight; |
126
|
|
|
$this->description = $description; |
127
|
|
|
$this->caption = $caption; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @return string |
133
|
|
|
*/ |
134
|
|
|
public function getPhotoUrl() |
135
|
|
|
{ |
136
|
|
|
return $this->photoUrl; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* @param string $photoUrl |
141
|
|
|
*/ |
142
|
|
|
public function setPhotoUrl($photoUrl) |
143
|
|
|
{ |
144
|
|
|
$this->photoUrl = $photoUrl; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* @return int |
149
|
|
|
*/ |
150
|
|
|
public function getPhotoWidth() |
151
|
|
|
{ |
152
|
|
|
return $this->photoWidth; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @param int $photoWidth |
157
|
|
|
*/ |
158
|
|
|
public function setPhotoWidth($photoWidth) |
159
|
|
|
{ |
160
|
|
|
$this->photoWidth = $photoWidth; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @return int |
165
|
|
|
*/ |
166
|
|
|
public function getPhotoHeight() |
167
|
|
|
{ |
168
|
|
|
return $this->photoHeight; |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
/** |
172
|
|
|
* @param int $photoHeight |
173
|
|
|
*/ |
174
|
|
|
public function setPhotoHeight($photoHeight) |
175
|
|
|
{ |
176
|
|
|
$this->photoHeight = $photoHeight; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* @return mixed |
181
|
|
|
*/ |
182
|
|
|
public function getThumbUrl() |
183
|
|
|
{ |
184
|
|
|
return $this->thumbUrl; |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* @param mixed $thumbUrl |
189
|
|
|
*/ |
190
|
|
|
public function setThumbUrl($thumbUrl) |
191
|
|
|
{ |
192
|
|
|
$this->thumbUrl = $thumbUrl; |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
/** |
196
|
|
|
* @return string |
197
|
|
|
*/ |
198
|
|
|
public function getDescription() |
199
|
|
|
{ |
200
|
|
|
return $this->description; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* @param string $description |
205
|
|
|
*/ |
206
|
|
|
public function setDescription($description) |
207
|
|
|
{ |
208
|
|
|
$this->description = $description; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* @return string |
213
|
|
|
*/ |
214
|
|
|
public function getCaption() |
215
|
|
|
{ |
216
|
|
|
return $this->caption; |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* @param string $caption |
221
|
|
|
*/ |
222
|
|
|
public function setCaption($caption) |
223
|
|
|
{ |
224
|
|
|
$this->caption = $caption; |
225
|
|
|
} |
226
|
|
|
} |
227
|
|
|
|