EditMessageLiveLocationMethod   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 85
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 23
dl 0
loc 85
ccs 17
cts 17
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 17 2
A createInline() 0 15 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Method;
6
7
use TgBotApi\BotApiBase\Method\Interfaces\EditMethodAliasInterface;
8
use TgBotApi\BotApiBase\Method\Traits\EditMessageVariablesTrait;
9
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait;
10
11
/**
12
 * Class EditMessageLiveLocationMethod.
13
 *
14
 * @see https://core.telegram.org/bots/api#editmessagelivelocation
15
 */
16
class EditMessageLiveLocationMethod implements EditMethodAliasInterface
17
{
18
    use EditMessageVariablesTrait;
19
    use FillFromArrayTrait;
20
21
    /**
22
     * Latitude of the location.
23
     *
24
     * @var float
25
     */
26
    public $latitude;
27
28
    /**
29
     * Longitude of the location.
30
     *
31
     * @var float
32
     */
33
    public $longitude;
34
35
    /**
36
     * Optional. The radius of uncertainty for the location, measured in meters; 0-1500.
37
     *
38
     * @var float|int|null
39
     */
40
    public $horizontalAccuracy;
41
42
    /**
43
     * Optional. Direction in which the user is moving, in degrees.
44
     * Must be between 1 and 360 if specified.
45
     *
46
     * @var int|null
47
     */
48
    public $heading;
49
50
    /**
51
     * Optional. Maximum distance for proximity alerts about
52
     * approaching another chat member, in meters.
53
     * Must be between 1 and 100000 if specified.
54
     *
55
     * @var int|null
56
     */
57
    public $proximityAlertRadius;
58
59
    /**
60
     * @param int|string $chatId
61
     *
62
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
63
     */
64 1
    public static function create(
65
        $chatId,
66
        int $messageId,
67
        float $latitude,
68
        float $longitude,
69
        array $data = null
70
    ): EditMessageLiveLocationMethod {
71 1
        $instance = new static();
72 1
        $instance->chatId = $chatId;
73 1
        $instance->messageId = $messageId;
74 1
        $instance->latitude = $latitude;
75 1
        $instance->longitude = $longitude;
76 1
        if ($data) {
77 1
            $instance->fill($data, ['chatId', 'messageId', 'latitude', 'longitude', 'inlineMessageId']);
78
        }
79
80 1
        return $instance;
81
    }
82
83
    /**
84
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
85
     */
86 1
    public static function createInline(
87
        string $inlineMessageId,
88
        float $latitude,
89
        float $longitude,
90
        array $data = null
91
    ): EditMessageLiveLocationMethod {
92 1
        $instance = new static();
93 1
        $instance->latitude = $latitude;
94 1
        $instance->longitude = $longitude;
95 1
        $instance->inlineMessageId = $inlineMessageId;
96 1
        if ($data) {
97 1
            $instance->fill($data, ['chatId', 'latitude', 'longitude', 'inlineMessageId']);
98
        }
99
100 1
        return $instance;
101
    }
102
}
103