Passed
Pull Request — master (#44)
by Nikolay
15:17
created

UnpinAllChatMessageMethod::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 1
crap 1
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
10
/**
11
 * Use this method to clear the list of pinned messages in a chat.
12
 * If the chat is not a private chat, the bot must be an administrator
13
 * in the chat for this to work and must have the 'can_pin_messages'
14
 * admin right in a supergroup or 'can_edit_messages' admin right in a channel.
15
 * Returns True on success.
16
 *
17
 * @see https://core.telegram.org/bots/api#unpinallchatmessages
18
 */
19
class UnpinAllChatMessageMethod implements UnpinMethodAliasInterface
20
{
21
    use ChatIdVariableTrait;
22
23
    /**
24
     * @param int|string $chatId
25
     */
26 1
    public static function create($chatId): UnpinAllChatMessageMethod
27
    {
28 1
        $instance = new static();
29 1
        $instance->chatId = $chatId;
30
31 1
        return $instance;
32
    }
33
}
34