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

StopMessageLiveLocationMethod   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
eloc 11
dl 0
loc 49
ccs 0
cts 17
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 2
A create() 0 6 1
A createInline() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Greenplugin\TelegramBot\Method;
6
7
use Greenplugin\TelegramBot\Method\Traits\EditMessageVariablesTrait;
8
use Greenplugin\TelegramBot\Method\Traits\FillFromArrayTrait;
9
10
/**
11
 * Class StopMessageLiveLocationType.
12
 *
13
 * @see https://core.telegram.org/bots/api#stopmessagelivelocation
14
 */
15
class StopMessageLiveLocationMethod
16
{
17
    use FillFromArrayTrait;
18
    use EditMessageVariablesTrait;
19
20
    /**
21
     * StopMessageLiveLocationMethod constructor.
22
     *
23
     * @param array|null $data
24
     *
25
     * @throws \Greenplugin\TelegramBot\Exception\BadArgumentException
26
     */
27
    public function __construct(array $data = null)
28
    {
29
        if ($data) {
30
            $this->fill($data);
31
        }
32
    }
33
34
    /**
35
     * @param int|string $chatId
36
     * @param array|null $data
37
     *
38
     * @throws \Greenplugin\TelegramBot\Exception\BadArgumentException
39
     *
40
     * @return StopMessageLiveLocationMethod
41
     */
42
    public static function create($chatId, array $data = null): StopMessageLiveLocationMethod
43
    {
44
        $method = new self($data);
45
        $method->chatId = $chatId;
46
47
        return $method;
48
    }
49
50
    /**
51
     * @param string     $inlineMessageId
52
     * @param array|null $data
53
     *
54
     * @throws \Greenplugin\TelegramBot\Exception\BadArgumentException
55
     *
56
     * @return StopMessageLiveLocationMethod
57
     */
58
    public static function createInline(string $inlineMessageId, array $data = null): StopMessageLiveLocationMethod
59
    {
60
        $method = new self($data);
61
        $method->inlineMessageId = $inlineMessageId;
62
63
        return $method;
64
    }
65
}
66