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

InputVenueMessageContent   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 16
dl 0
loc 75
ccs 0
cts 16
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 17 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Type\InputMessageContent;
6
7
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait;
8
9
/**
10
 * Class InputVenueMessageContent.
11
 *
12
 * @see https://core.telegram.org/bots/api#inputvenuemessagecontent
13
 */
14
class InputVenueMessageContent extends InputMessageContentType
15
{
16
    use FillFromArrayTrait;
17
18
    /**
19
     * Latitude of the venue in degrees.
20
     *
21
     * @var float
22
     */
23
    public $latitude;
24
25
    /**
26
     * Longitude of the venue in degrees.
27
     *
28
     * @var float
29
     */
30
    public $longitude;
31
32
    /**
33
     * Name of the venue.
34
     *
35
     * @var string
36
     */
37
    public $title;
38
39
    /**
40
     * Address of the venue.
41
     *
42
     * @var string
43
     */
44
    public $address;
45
46
    /**
47
     * Optional. Foursquare identifier of the venue, if known.
48
     *
49
     * @var string|null
50
     */
51
    public $foursquareId;
52
53
    /**
54
     * Optional. Foursquare type of the venue, if known.
55
     * (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.).
56
     *
57
     * @var string|null
58
     */
59
    public $foursquareType;
60
61
    /**
62
     * @param float      $latitude
63
     * @param float      $longitude
64
     * @param string     $title
65
     * @param string     $address
66
     * @param array|null $data
67
     *
68
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
69
     *
70
     * @return InputVenueMessageContent
71
     */
72
    public static function create(
73
        float $latitude,
74
        float $longitude,
75
        string $title,
76
        string $address,
77
        array $data = null
78
    ): InputVenueMessageContent {
79
        $instance = new static();
80
        $instance->latitude = $latitude;
81
        $instance->longitude = $longitude;
82
        $instance->title = $title;
83
        $instance->address = $address;
84
        if ($data) {
85
            $instance->fill($data);
86
        }
87
88
        return $instance;
89
    }
90
}
91