UnpinChatMessageMethod   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 9
dl 0
loc 28
ccs 6
cts 6
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\UnpinMethodAliasInterface;
8
use TgBotApi\BotApiBase\Method\Traits\ChatIdVariableTrait;
9
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait;
10
11
/**
12
 * Class UnpinChatMessageMethod.
13
 *
14
 * @see https://core.telegram.org/bots/api#unpinchatmessage
15
 */
16
class UnpinChatMessageMethod implements UnpinMethodAliasInterface
17
{
18
    use FillFromArrayTrait;
19
    use ChatIdVariableTrait;
20
21
    /**
22
     * Optional Identifier of a message to unpin. If not specified,
23
     * the most recent pinned message (by sending date) will be unpinned.
24
     *
25
     * @var int|null
26
     */
27
    public $messageId;
28
29
    /**
30
     * @param int|string $chatId
31
     *
32
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
33
     */
34 1
    public static function create($chatId, array $data = null): UnpinChatMessageMethod
35
    {
36 1
        $instance = new static();
37 1
        $instance->chatId = $chatId;
38
39 1
        if (!empty($data)) {
40 1
            $instance->fill($data);
41
        }
42
43 1
        return $instance;
44
    }
45
}
46