InputVenueMessageContent::create()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

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