Passed
Push — master ( c05883...1d5c29 )
by Nikolay
02:30
created

InlineQueryResultVenueType   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 107
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 22
dl 0
loc 107
ccs 0
cts 19
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 20 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Type\InlineQueryResult;
6
7
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait;
8
use TgBotApi\BotApiBase\Type\InputMessageContent\InputMessageContentType;
9
10
/**
11
 * Class InlineQueryResultVenueType.
12
 *
13
 * Represents a venue. By default, the venue will be sent by the user.
14
 * Alternatively, you can use input_message_content to send a message with the specified content instead of the venue.
15
 *
16
 * @see https://core.telegram.org/bots/api#inlinequeryresultvenue
17
 */
18
class InlineQueryResultVenueType extends InlineQueryResultType
19
{
20
    use FillFromArrayTrait;
21
22
    /**
23
     * Latitude of the venue location in degrees.
24
     *
25
     * @var float
26
     */
27
    public $latitude;
28
29
    /**
30
     * Longitude of the venue location in degrees.
31
     *
32
     * @var float
33
     */
34
    public $longitude;
35
36
    /**
37
     * Title of the venue.
38
     *
39
     * @var string
40
     */
41
    public $title;
42
43
    /**
44
     * Address of the venue.
45
     *
46
     * @var string
47
     */
48
    public $address;
49
50
    /**
51
     * Optional. Foursquare identifier of the venue if known.
52
     *
53
     * @var string|null
54
     */
55
    public $foursquareId;
56
57
    /**
58
     * Optional. Foursquare type of the venue, if known.
59
     * (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.).
60
     *
61
     * @var string|null
62
     */
63
    public $foursquareType;
64
65
    /**
66
     * Optional. Content of the message to be sent instead of the venue.
67
     *
68
     * @var InputMessageContentType|null
69
     */
70
    public $inputMessageContent;
71
72
    /**
73
     * Optional. Url of the thumbnail for the result.
74
     *
75
     * @var string|null
76
     */
77
    public $thumbUrl;
78
79
    /**
80
     * Optional. Thumbnail width.
81
     *
82
     * @var int|null
83
     */
84
    public $thumbWidth;
85
86
    /**
87
     * Optional. Thumbnail height.
88
     *
89
     * @var int|null
90
     */
91
    public $thumbHeight;
92
93
    /**
94
     * @param string     $id
95
     * @param float      $latitude
96
     * @param float      $longitude
97
     * @param string     $title
98
     * @param string     $address
99
     * @param array|null $data
100
     *
101
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
102
     *
103
     * @return InlineQueryResultVenueType
104
     */
105
    public static function create(
106
        string $id,
107
        float $latitude,
108
        float $longitude,
109
        string $title,
110
        string $address,
111
        array $data = null
112
    ): InlineQueryResultVenueType {
113
        $instance = new static();
114
        $instance->type = static::TYPE_VENUE;
115
        $instance->id = $id;
116
        $instance->latitude = $latitude;
117
        $instance->longitude = $longitude;
118
        $instance->title = $title;
119
        $instance->address = $address;
120
        if ($data) {
121
            $instance->fill($data);
122
        }
123
124
        return $instance;
125
    }
126
}
127