StopMessageLiveLocationMethod::createInline()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 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