StopMessageLiveLocationMethod   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 14
dl 0
loc 43
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

2 Methods

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