Completed
Push — master ( c7964b...0f9e90 )
by Gusev
02:58
created

Venue::getThumbWidth()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: iGusev
5
 * Date: 18/04/16
6
 * Time: 04:19
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 Venue
16
 *
17
 * @see https://core.telegram.org/bots/api#inlinequeryresultvenue
18
 * Represents a venue. By default, the venue will be sent by the user.
19
 * Alternatively, you can use InputMessageContent to send a message with the specified content instead of the venue.
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 Venue extends AbstractInlineQueryResult
26
{
27
    /**
28
     * {@inheritdoc}
29
     *
30
     * @var array
31
     */
32
    static protected $requiredParams = ['type', 'id', 'latitude', 'longitude', 'title', 'address'];
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
        'address' => true,
46
        'foursquare_id' => true,
47
        'thumb_url' => true,
48
        'thumb_width' => true,
49
        'thumb_height' => true,
50
        'reply_markup' => InlineKeyboardMarkup::class,
51
        'input_message_content' => InputMessageContent::class,
52
    ];
53
54
    /**
55
     * {@inheritdoc}
56
     *
57
     * @var string
58
     */
59
    protected $type = 'venue';
60
61
    /**
62
     * Latitude of the venue location in degrees
63
     *
64
     * @var float
65
     */
66
    protected $latitude;
67
68
    /**
69
     * Longitude of the venue location in degrees
70
     *
71
     * @var float
72
     */
73
    protected $longitude;
74
75
    /**
76
     * Optional. Thumbnail width
77
     *
78
     * @var string
79
     */
80
    protected $address;
81
82
    /**
83
     * Optional. Url of the thumbnail for the result
84
     *
85
     * @var string
86
     */
87
    protected $thumbUrl;
88
89
    /**
90
     * Optional. Thumbnail width
91
     *
92
     * @var int
93
     */
94
    protected $thumbWidth;
95
96
    /**
97
     * Optional. Thumbnail height
98
     *
99
     * @var int
100
     */
101
    protected $thumbHeight;
102
103
    /**
104
     * Optional. Foursquare identifier of the venue if known
105
     *
106
     * @var int
107
     */
108
    protected $foursquareId;
109
110
    /**
111
     * Voice constructor
112
     *
113
     * @param string $id
114
     * @param float $latitude
115
     * @param float $longitude
116
     * @param string $title
117
     * @param string $address
118
     * @param string $thumbUrl
119
     * @param int $thumbWidth
120
     * @param int $thumbHeight
121
     * @param string $foursquareId
122
     * @param InlineKeyboardMarkup|null $inlineKeyboardMarkup
123
     * @param InputMessageContent|null $inputMessageContent
124
     */
125
    public function __construct(
126
        $id,
127
        $latitude,
128
        $longitude,
129
        $title,
130
        $address,
131
        $thumbUrl = null,
132
        $thumbWidth = null,
133
        $thumbHeight = null,
134
        $foursquareId = null,
135
        $inputMessageContent = null,
136
        $inlineKeyboardMarkup = null
137
    ) {
138
        parent::__construct($id, $title, $inputMessageContent, $inlineKeyboardMarkup);
139
140
        $this->latitude = $latitude;
141
        $this->longitude = $longitude;
142
        $this->address = $address;
143
        $this->thumbUrl = $thumbUrl;
144
        $this->thumbWidth = $thumbWidth;
145
        $this->thumbHeight = $thumbHeight;
146
        $this->foursquareId = $foursquareId;
0 ignored issues
show
Documentation Bug introduced by
It seems like $foursquareId can also be of type string. However, the property $foursquareId is declared as type integer. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
147
    }
148
149
    /**
150
     * @return float
151
     */
152
    public function getLatitude()
153
    {
154
        return $this->latitude;
155
    }
156
157
    /**
158
     * @param float $latitude
159
     */
160
    public function setLatitude($latitude)
161
    {
162
        $this->latitude = $latitude;
163
    }
164
165
    /**
166
     * @return float
167
     */
168
    public function getLongitude()
169
    {
170
        return $this->longitude;
171
    }
172
173
    /**
174
     * @param float $longitude
175
     */
176
    public function setLongitude($longitude)
177
    {
178
        $this->longitude = $longitude;
179
    }
180
181
    /**
182
     * @return string
183
     */
184
    public function getAddress()
185
    {
186
        return $this->address;
187
    }
188
189
    /**
190
     * @param string $address
191
     */
192
    public function setAddress($address)
193
    {
194
        $this->address = $address;
195
    }
196
197
    /**
198
     * @return int
199
     */
200
    public function getFoursquareId()
201
    {
202
        return $this->foursquareId;
203
    }
204
205
    /**
206
     * @param int $foursquareId
207
     */
208
    public function setFoursquareId($foursquareId)
209
    {
210
        $this->foursquareId = $foursquareId;
211
    }
212
213
    /**
214
     * @return string
215
     */
216
    public function getThumbUrl()
217
    {
218
        return $this->thumbUrl;
219
    }
220
221
    /**
222
     * @param string $thumbUrl
223
     */
224
    public function setThumbUrl($thumbUrl)
225
    {
226
        $this->thumbUrl = $thumbUrl;
227
    }
228
229
    /**
230
     * @return int
231
     */
232
    public function getThumbWidth()
233
    {
234
        return $this->thumbWidth;
235
    }
236
237
    /**
238
     * @param int $thumbWidth
239
     */
240
    public function setThumbWidth($thumbWidth)
241
    {
242
        $this->thumbWidth = $thumbWidth;
243
    }
244
245
    /**
246
     * @return int
247
     */
248
    public function getThumbHeight()
249
    {
250
        return $this->thumbHeight;
251
    }
252
253
    /**
254
     * @param int $thumbHeight
255
     */
256
    public function setThumbHeight($thumbHeight)
257
    {
258
        $this->thumbHeight = $thumbHeight;
259
    }
260
}
261