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

EditMessageReplyMarkupMethod::createInline()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
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 11
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\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