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

InputLocationMessageContentType   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 11
dl 0
loc 46
ccs 0
cts 12
cp 0
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
     * Latitude of the location in degrees.
19
     *
20
     * @var float
21
     */
22
    public $latitude;
23
24
    /**
25
     * Longitude of the location in degrees.
26
     *
27
     * @var float
28
     */
29
    public $longitude;
30
31
    /**
32
     * Optional. Period in seconds for which the location can be updated, should be between 60 and 86400.
33
     *
34
     * @var int|null
35
     */
36
    public $livePeriod;
37
38
    /**
39
     * @param float      $latitude
40
     * @param float      $longitude
41
     * @param array|null $data
42
     *
43
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
44
     *
45
     * @return InputLocationMessageContentType
46
     */
47
    public static function create(
48
        float $latitude,
49
        float $longitude,
50
        array $data = null
51
    ): InputLocationMessageContentType {
52
        $instance = new static();
53
        $instance->latitude = $latitude;
54
        $instance->longitude = $longitude;
55
        if ($data) {
56
            $instance->fill($data);
57
        }
58
59
        return $instance;
60
    }
61
}
62