Passed
Push — master ( 58897c...6910c8 )
by Alexander
06:09 queued 12s
created

Location::getLatitude()   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 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 3
cp 0
rs 10
cc 1
nc 1
nop 0
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
    static protected $requiredParams = ['type', 'id', 'latitude', 'longitude', 'title'];
33
34
    /**
35
     * {@inheritdoc}
36
     *
37
     * @var array
38
     */
39
    static protected $map = [
40
        'type' => true,
41
        'id' => true,
42
        'latitude' => true,
43
        'longitude' => true,
44
        'title' => true,
45
        'thumb_url' => true,
46
        'thumb_width' => true,
47
        'thumb_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
77
     */
78
    protected $thumbUrl;
79
80
    /**
81
     * Optional. Thumbnail width
82
     *
83
     * @var int
84
     */
85
    protected $thumbWidth;
86
87
    /**
88
     * Optional. Thumbnail height
89
     *
90
     * @var int
91
     */
92
    protected $thumbHeight;
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 $thumbUrl
102
     * @param int $thumbWidth
103
     * @param int $thumbHeight
104
     * @param InlineKeyboardMarkup|null $inlineKeyboardMarkup
105
     * @param InputMessageContent|null $inputMessageContent
106
     */
107
    public function __construct(
108
        $id,
109
        $latitude,
110
        $longitude,
111
        $title,
112
        $thumbUrl = null,
113
        $thumbWidth = null,
114
        $thumbHeight = 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->thumbUrl = $thumbUrl;
123
        $this->thumbWidth = $thumbWidth;
124
        $this->thumbHeight = $thumbHeight;
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
    public function setLatitude($latitude)
139
    {
140
        $this->latitude = $latitude;
141
    }
142
143
    /**
144
     * @return float
145
     */
146
    public function getLongitude()
147
    {
148
        return $this->longitude;
149
    }
150
151
    /**
152
     * @param float $longitude
153
     */
154
    public function setLongitude($longitude)
155
    {
156
        $this->longitude = $longitude;
157
    }
158
159
    /**
160
     * @return string
161
     */
162
    public function getThumbUrl()
163
    {
164
        return $this->thumbUrl;
165
    }
166
167
    /**
168
     * @param string $thumbUrl
169
     */
170
    public function setThumbUrl($thumbUrl)
171
    {
172
        $this->thumbUrl = $thumbUrl;
173
    }
174
175
    /**
176
     * @return int
177
     */
178
    public function getThumbWidth()
179
    {
180
        return $this->thumbWidth;
181
    }
182
183
    /**
184
     * @param int $thumbWidth
185
     */
186
    public function setThumbWidth($thumbWidth)
187
    {
188
        $this->thumbWidth = $thumbWidth;
189
    }
190
191
    /**
192
     * @return int
193
     */
194
    public function getThumbHeight()
195
    {
196
        return $this->thumbHeight;
197
    }
198
199
    /**
200
     * @param int $thumbHeight
201
     */
202
    public function setThumbHeight($thumbHeight)
203
    {
204
        $this->thumbHeight = $thumbHeight;
205
    }
206
}
207