Completed
Push — master ( e5cded...a829ef )
by Alexander
29s queued 14s
created

Location::setThumbnailHeight()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 0
cts 0
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: iGusev
5
 * Date: 18/04/16
6
 * Time: 04:00
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
/**
15
 * Class Location
16
 *
17
 * @see https://core.telegram.org/bots/api#inlinequeryresultlocation
18
 * Represents a location on a map. By default, the location will be sent by the user.
19
 * Alternatively, you can use InputMessageContent to send a message with the specified content instead of the location.
20
 *
21
 * Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
22
 *
23
 * @package TelegramBot\Api\Types\Inline\QueryResult
24
 */
25
class Location extends AbstractInlineQueryResult
26
{
27
    /**
28
     * {@inheritdoc}
29
     *
30
     * @var array
31
     */
32
    protected static $requiredParams = ['type', 'id', 'latitude', 'longitude', 'title'];
33
34
    /**
35
     * {@inheritdoc}
36
     *
37
     * @var array
38
     */
39
    protected static $map = [
40
        'type' => true,
41
        'id' => true,
42
        'latitude' => true,
43
        'longitude' => true,
44
        'title' => true,
45
        'thumbnail_url' => true,
46
        'thumbnail_width' => true,
47
        'thumbnail_height' => true,
48
        'reply_markup' => InlineKeyboardMarkup::class,
49
        'input_message_content' => InputMessageContent::class,
50
    ];
51
52
    /**
53
     * {@inheritdoc}
54
     *
55
     * @var string
56
     */
57
    protected $type = 'location';
58
59
    /**
60
     * Location latitude in degrees
61
     *
62
     * @var float
63
     */
64
    protected $latitude;
65
66
    /**
67
     * Location longitude in degrees
68
     *
69
     * @var float
70
     */
71
    protected $longitude;
72
73
    /**
74
     * Optional. Url of the thumbnail for the result
75
     *
76
     * @var string|null
77
     */
78
    protected $thumbnailUrl;
79
80
    /**
81
     * Optional. Thumbnail width
82
     *
83
     * @var int|null
84
     */
85
    protected $thumbnailWidth;
86
87
    /**
88
     * Optional. Thumbnail height
89
     *
90
     * @var int|null
91
     */
92
    protected $thumbnailHeight;
93
94
    /**
95
     * Voice constructor
96
     *
97
     * @param string $id
98
     * @param float $latitude
99
     * @param float $longitude
100
     * @param string $title
101
     * @param string|null $thumbnailUrl
102
     * @param int|null $thumbnailWidth
103
     * @param int|null $thumbnailHeight
104
     * @param InlineKeyboardMarkup|null $inlineKeyboardMarkup
105
     * @param InputMessageContent|null $inputMessageContent
106
     */
107
    public function __construct(
108
        $id,
109
        $latitude,
110
        $longitude,
111
        $title,
112
        $thumbnailUrl = null,
113
        $thumbnailWidth = null,
114
        $thumbnailHeight = null,
115
        $inlineKeyboardMarkup = null,
116
        $inputMessageContent = null
117
    ) {
118
        parent::__construct($id, $title, $inputMessageContent, $inlineKeyboardMarkup);
119
120
        $this->latitude = $latitude;
121
        $this->longitude = $longitude;
122
        $this->thumbnailUrl = $thumbnailUrl;
123
        $this->thumbnailWidth = $thumbnailWidth;
124
        $this->thumbnailHeight = $thumbnailHeight;
125
    }
126
127
    /**
128
     * @return float
129
     */
130
    public function getLatitude()
131
    {
132
        return $this->latitude;
133
    }
134
135
    /**
136
     * @param float $latitude
137
     *
138
     * @return void
139
     */
140
    public function setLatitude($latitude)
141
    {
142
        $this->latitude = $latitude;
143
    }
144
145
    /**
146
     * @return float
147
     */
148
    public function getLongitude()
149
    {
150
        return $this->longitude;
151
    }
152
153
    /**
154
     * @param float $longitude
155
     *
156
     * @return void
157
     */
158
    public function setLongitude($longitude)
159
    {
160
        $this->longitude = $longitude;
161
    }
162
163
    /**
164
     * @return string|null
165
     */
166
    public function getThumbnailUrl()
167
    {
168
        return $this->thumbnailUrl;
169
    }
170
171
    /**
172
     * @param string|null $thumbnailUrl
173
     *
174
     * @return void
175
     */
176
    public function setThumbnailUrl($thumbnailUrl)
177
    {
178
        $this->thumbnailUrl = $thumbnailUrl;
179
    }
180
181
    /**
182
     * @deprecated Use getThumbnailUrl
183
     *
184
     * @return string|null
185
     */
186
    public function getThumbUrl()
187
    {
188
        return $this->getThumbnailUrl();
189
    }
190
191
    /**
192
     * @deprecated Use setThumbnailUrl
193
     *
194
     * @param string|null $thumbUrl
195
     *
196
     * @return void
197
     */
198
    public function setThumbUrl($thumbUrl)
199
    {
200
        $this->setThumbnailUrl($thumbUrl);
201
    }
202
203
    /**
204
     * @return int|null
205
     */
206
    public function getThumbnailWidth()
207
    {
208
        return $this->thumbnailWidth;
209
    }
210
211
    /**
212
     * @param int|null $thumbnailWidth
213
     *
214
     * @return void
215
     */
216
    public function setThumbnailWidth($thumbnailWidth)
217
    {
218
        $this->thumbnailWidth = $thumbnailWidth;
219
    }
220
221
    /**
222
     * @deprecated Use getThumbnailWidth
223
     *
224
     * @return int|null
225
     */
226
    public function getThumbWidth()
227
    {
228
        return $this->getThumbnailWidth();
229
    }
230
231
    /**
232
     * @deprecated Use setThumbnailWidth
233
     *
234
     * @param int|null $thumbWidth
235
     *
236
     * @return void
237
     */
238
    public function setThumbWidth($thumbWidth)
239
    {
240
        $this->setThumbnailWidth($thumbWidth);
241
    }
242
243
    /**
244
     * @return int|null
245
     */
246
    public function getThumbnailHeight()
247
    {
248
        return $this->thumbnailHeight;
249
    }
250
251
    /**
252
     * @param int|null $thumbnailHeight
253
     *
254
     * @return void
255
     */
256
    public function setThumbnailHeight($thumbnailHeight)
257
    {
258
        $this->thumbnailHeight = $thumbnailHeight;
259
    }
260
261
    /**
262
     * @deprecated Use getThumbnailHeight
263
     *
264
     * @return int|null
265
     */
266
    public function getThumbHeight()
267
    {
268
        return $this->getThumbnailHeight();
269
    }
270
271
    /**
272
     * @deprecated Use setThumbnailWidth
273
     *
274
     * @param int|null $thumbHeight
275
     *
276
     * @return void
277
     */
278
    public function setThumbHeight($thumbHeight)
279
    {
280
        $this->setThumbnailHeight($thumbHeight);
281
    }
282
}
283