Completed
Push — master ( 7d37a2...fea370 )
by Nikolay
06:21
created

SendLocationMethod   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 83.33%

Importance

Changes 0
Metric Value
wmc 2
eloc 11
dl 0
loc 43
ccs 5
cts 6
cp 0.8333
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Greenplugin\TelegramBot\Method;
6
7
use Greenplugin\TelegramBot\Method\Traits\FillFromArrayTrait;
8
use Greenplugin\TelegramBot\Method\Traits\SendToChatVariablesTrait;
9
10
/**
11
 * Class SendLocationMethod.
12
 *
13
 * @see https://core.telegram.org/bots/api#sendlocation
14
 */
15
class SendLocationMethod
16
{
17
    use FillFromArrayTrait;
18
    use SendToChatVariablesTrait;
19
20
    /**
21
     * Latitude of the location.
22
     *
23
     * @var float
24
     */
25
    public $latitude;
26
27
    /**
28
     * Longitude of the location.
29
     *
30
     * @var float
31
     */
32
    public $longitude;
33
34
    /**
35
     * Period in seconds for which the location will be updated (see Live Locations, should be between 60 and 86400.
36
     *
37
     * @var int|null
38
     */
39
    public $livePeriod;
40
41
    /**
42
     * SendGroupMethod constructor.
43
     *
44
     * @param int|string $chatId
45
     * @param float      $latitude
46
     * @param float      $longitude
47
     * @param array|null $data
48
     *
49
     * @throws \Greenplugin\TelegramBot\Exception\BadArgumentException
50
     */
51 3
    public function __construct($chatId, float $latitude, float $longitude, array $data = null)
52
    {
53 3
        $this->chatId = $chatId;
54 3
        $this->latitude = $latitude;
55 3
        $this->longitude = $longitude;
56 3
        if ($data) {
57
            $this->fill($data);
58
        }
59 3
    }
60
}
61