Completed
Push — master ( d04b6a...4e4c0e )
by Nikolay
03:14
created

EditMessageReplyMarkupMethod   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 14
dl 0
loc 45
ccs 13
cts 13
cp 1
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\Interfaces\EditMethodAliasInterface;
8
use TgBotApi\BotApiBase\Method\Traits\EditMessageVariablesTrait;
9
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait;
10
11
/**
12
 * Class EditMessageReplyMarkupMethod.
13
 *
14
 * @see https://core.telegram.org/bots/api#editmessagereplymarkup
15
 */
16
class EditMessageReplyMarkupMethod implements EditMethodAliasInterface
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 EditMessageReplyMarkupMethod
29
     */
30 1
    public static function create($chatId, int $messageId, array $data = null): EditMessageReplyMarkupMethod
31
    {
32 1
        $instance = new self();
33 1
        $instance->chatId = $chatId;
34 1
        $instance->messageId = $messageId;
35 1
        if ($data) {
36 1
            $instance->fill($data, ['chatId', 'messageId', '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 EditMessageReplyMarkupMethod
49
     */
50 1
    public static function createInline(
51
        string $inlineMessageId,
52
        array $data = null
53
    ): EditMessageReplyMarkupMethod {
54 1
        $instance = new self();
55 1
        $instance->inlineMessageId = $inlineMessageId;
56 1
        if ($data) {
57 1
            $instance->fill($data, ['chatId', 'messageId', 'inlineMessageId']);
58
        }
59
60 1
        return $instance;
61
    }
62
}
63