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

EditMessageReplyMarkupMethod   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
eloc 14
dl 0
loc 45
ccs 0
cts 20
cp 0
rs 10
c 0
b 0
f 0

2 Methods

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