Completed
Push — master ( 588078...30ae0c )
by Nikolay
04:51 queued 02:15
created

EditMessageReplyMarkupMethod   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
eloc 12
dl 0
loc 56
ccs 0
cts 21
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A createInline() 0 9 1
A create() 0 6 1
A __construct() 0 5 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Greenplugin\TelegramBot\Method;
6
7
use Greenplugin\TelegramBot\Method\Traits\EditMessageVariablesTrait;
8
use Greenplugin\TelegramBot\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
     * EditMessageReplyMarkupMethod constructor.
22
     *
23
     * @param int|string $chatId
24
     * @param array|null $data
25
     *
26
     * @throws \Greenplugin\TelegramBot\Exception\BadArgumentException
27
     */
28
    public function __construct($chatId, array $data = null)
29
    {
30
        $this->chatId = $chatId;
31
        if ($data) {
32
            $this->fill($data);
33
        }
34
    }
35
36
    /**
37
     * @param int|string $chatId
38
     * @param int        $messageId
39
     * @param array|null $data
40
     *
41
     * @throws \Greenplugin\TelegramBot\Exception\BadArgumentException
42
     *
43
     * @return EditMessageReplyMarkupMethod
44
     */
45
    public static function create($chatId, int $messageId, array $data = null): EditMessageReplyMarkupMethod
46
    {
47
        $instance = new self($chatId, $data);
48
        $instance->messageId = $messageId;
49
50
        return $instance;
51
    }
52
53
    /**
54
     * @param int|string $chatId
55
     * @param string     $inlineMessageId
56
     * @param array|null $data
57
     *
58
     * @throws \Greenplugin\TelegramBot\Exception\BadArgumentException
59
     *
60
     * @return EditMessageReplyMarkupMethod
61
     */
62
    public static function createInline(
63
        $chatId,
64
        string $inlineMessageId,
65
        array $data = null
66
    ): EditMessageReplyMarkupMethod {
67
        $instance = new self($chatId, $data);
68
        $instance->inlineMessageId = $inlineMessageId;
69
70
        return $instance;
71
    }
72
}
73