InputLocationMessageContentType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 14
dl 0
loc 65
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 13 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Type\InputMessageContent;
6
7
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait;
8
9
/**
10
 * Class InputLocationMessageContentType.
11
 *
12
 * @see https://core.telegram.org/bots/api#inputlocationmessagecontent
13
 */
14
class InputLocationMessageContentType extends InputMessageContentType
15
{
16
    use FillFromArrayTrait;
17
18
    /**
19
     * Latitude of the location in degrees.
20
     *
21
     * @var float
22
     */
23
    public $latitude;
24
25
    /**
26
     * Longitude of the location in degrees.
27
     *
28
     * @var float
29
     */
30
    public $longitude;
31
32
    /**
33
     * Optional. The radius of uncertainty for the location, measured in meters; 0-1500.
34
     *
35
     * @var float|int|null
36
     */
37
    public $horizontalAccuracy;
38
39
    /**
40
     * Optional. Period in seconds for which the location can be updated, should be between 60 and 86400.
41
     *
42
     * @var int|null
43
     */
44
    public $livePeriod;
45
46
    /**
47
     * Optional. For live locations, a direction in which the user is moving, in degrees.
48
     * Must be between 1 and 360 if specified.
49
     *
50
     * @var int|null
51
     */
52
    public $heading;
53
54
    /**
55
     * Optional. For live locations, a maximum distance
56
     * for proximity alerts about approaching another chat member, in meters.
57
     * Must be between 1 and 100000 if specified.
58
     *
59
     * @var int|null
60
     */
61
    public $proximityAlertRadius;
62
63
    /**
64
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
65
     */
66 1
    public static function create(
67
        float $latitude,
68
        float $longitude,
69
        array $data = null
70
    ): InputLocationMessageContentType {
71 1
        $instance = new static();
72 1
        $instance->latitude = $latitude;
73 1
        $instance->longitude = $longitude;
74 1
        if ($data) {
75 1
            $instance->fill($data);
76
        }
77
78 1
        return $instance;
79
    }
80
}
81