PinChatMessageMethod   A
last analyzed

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