Completed
Push — master ( 62cb7b...4b7fdd )
by Nikolay
02:34
created

SendVenueMethod   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 83
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 18
dl 0
loc 83
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 19 2
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
 * @see https://core.telegram.org/bots/api#sendvenue
14
 */
15
class SendVenueMethod
16
{
17
    use FillFromArrayTrait;
18
    use SendToChatVariablesTrait;
19
20
    /**
21
     * Latitude of the venue.
22
     *
23
     * @var float
24
     */
25
    public $latitude;
26
27
    /**
28
     * Longitude of the venue.
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.
50
     *
51
     * @var string|null
52
     *
53
     * @see https://foursquare.com/
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
     * @see https://foursquare.com/
64
     */
65
    public $foursquareType;
66
67
    /**
68
     * @param int|string $chatId
69
     * @param float      $latitude
70
     * @param float      $longitude
71
     * @param string     $title
72
     * @param string     $address
73
     * @param array|null $data
74
     *
75
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
76
     *
77
     * @return SendVenueMethod
78
     */
79 2
    public static function create(
80
        $chatId,
81
        float $latitude,
82
        float $longitude,
83
        string $title,
84
        string $address,
85
        array $data = null
86
    ): SendVenueMethod {
87 2
        $instance = new static();
88 2
        $instance->chatId = $chatId;
89 2
        $instance->latitude = $latitude;
90 2
        $instance->longitude = $longitude;
91 2
        $instance->title = $title;
92 2
        $instance->address = $address;
93 2
        if ($data) {
94 1
            $instance->fill($data);
95
        }
96
97 2
        return $instance;
98
    }
99
}
100