SendVenueMethod   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 19
dl 0
loc 77
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\Interfaces\SendMethodAliasInterface;
8
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait;
9
use TgBotApi\BotApiBase\Method\Traits\GooglePlaceFieldsTrait;
10
use TgBotApi\BotApiBase\Method\Traits\SendToChatVariablesTrait;
11
12
/**
13
 * Class SendVenueMethod.
14
 *
15
 * @see https://core.telegram.org/bots/api#sendvenue
16
 */
17
class SendVenueMethod implements SendMethodAliasInterface
18
{
19
    use FillFromArrayTrait;
20
    use SendToChatVariablesTrait;
21
    use GooglePlaceFieldsTrait;
22
23
    /**
24
     * Latitude of the venue.
25
     *
26
     * @var float
27
     */
28
    public $latitude;
29
30
    /**
31
     * Longitude of the venue.
32
     *
33
     * @var float
34
     */
35
    public $longitude;
36
37
    /**
38
     * Name of the venue.
39
     *
40
     * @var string
41
     */
42
    public $title;
43
44
    /**
45
     * Address of the venue.
46
     *
47
     * @var string
48
     */
49
    public $address;
50
51
    /**
52
     * Optional. Foursquare identifier of the venue.
53
     *
54
     * @var string|null
55
     *
56
     * @see https://foursquare.com/
57
     */
58
    public $foursquareId;
59
60
    /**
61
     * Optional. Foursquare type of the venue, if known.
62
     * (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.).
63
     *
64
     * @var string|null
65
     *
66
     * @see https://foursquare.com/
67
     */
68
    public $foursquareType;
69
70
    /**
71
     * @param int|string $chatId
72
     *
73
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
74
     */
75 2
    public static function create(
76
        $chatId,
77
        float $latitude,
78
        float $longitude,
79
        string $title,
80
        string $address,
81
        array $data = null
82
    ): SendVenueMethod {
83 2
        $instance = new static();
84 2
        $instance->chatId = $chatId;
85 2
        $instance->latitude = $latitude;
86 2
        $instance->longitude = $longitude;
87 2
        $instance->title = $title;
88 2
        $instance->address = $address;
89 2
        if ($data) {
90 1
            $instance->fill($data);
91
        }
92
93 2
        return $instance;
94
    }
95
}
96