Passed
Push — master ( 3bfee0...112fc6 )
by Nikolay
02:02
created

PinChatMessageMethod   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 11
dl 0
loc 33
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 10 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Method;
6
7
use TgBotApi\BotApiBase\Method\Traits\ChatIdVariableTrait;
8
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait;
9
use TgBotApi\BotApiBase\Method\Traits\MessageIdVariableTrait;
10
11
/**
12
 * Class PinChatMessageMethod.
13
 *
14
 * @see https://core.telegram.org/bots/api#pinchatmessage
15
 */
16
class PinChatMessageMethod
17
{
18
    use FillFromArrayTrait;
19
    use ChatIdVariableTrait;
20
    use MessageIdVariableTrait;
21
22
    /**
23
     * Optional. Pass True, if it is not necessary to send a notification to all chat members about the new
24
     * pinned message. Notifications are always disabled in channels.
25
     *
26
     * @var bool|null
27
     */
28
    public $disableNotification;
29
30
    /**
31
     * @param int|string $chatId
32
     * @param int        $messageId
33
     * @param array|null $data
34
     *
35
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
36
     *
37
     * @return PinChatMessageMethod
38
     */
39 3
    public static function create($chatId, int $messageId, array $data = null): PinChatMessageMethod
40
    {
41 3
        $instance = new static();
42 3
        $instance->chatId = $chatId;
43 3
        $instance->messageId = $messageId;
44 3
        if ($data) {
45 3
            $instance->fill($data);
46
        }
47
48 3
        return $instance;
49
    }
50
}
51