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

SendVenueMethod::create()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 19
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 19
ccs 0
cts 10
cp 0
rs 9.9666
c 0
b 0
f 0
cc 2
nc 2
nop 6
crap 6
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Method;
6
7
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait;
8
use TgBotApi\BotApiBase\Method\Traits\SendToChatVariablesTrait;
9
10
/**
11
 * Class SendVenueMethod.
12
 */
13
class SendVenueMethod
14
{
15
    use FillFromArrayTrait;
16
    use SendToChatVariablesTrait;
17
18
    /**
19
     * Latitude of the venue.
20
     *
21
     * @var float
22
     */
23
    public $latitude;
24
25
    /**
26
     * Longitude of the venue.
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.
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 int|string $chatId
63
     * @param float      $latitude
64
     * @param float      $longitude
65
     * @param string     $title
66
     * @param string     $address
67
     * @param array|null $data
68
     *
69
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
70
     *
71
     * @return SendVenueMethod
72
     */
73
    public static function create(
74
        $chatId,
75
        float $latitude,
76
        float $longitude,
77
        string $title,
78
        $address,
79
        array $data = null
80
    ): SendVenueMethod {
81
        $instance = new static();
82
        $instance->chatId = $chatId;
83
        $instance->latitude = $latitude;
84
        $instance->longitude = $longitude;
85
        $instance->title = $title;
86
        $instance->address = $address;
87
        if ($data) {
88
            $instance->fill($data);
89
        }
90
91
        return $instance;
92
    }
93
}
94