Completed
Push — master ( fcd5b4...534fe0 )
by Nikolay
09:26 queued 10s
created

SetChatPermissionsMethod   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 7
c 1
b 0
f 0
dl 0
loc 22
ccs 5
cts 5
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Method;
6
7
use TgBotApi\BotApiBase\Method\Interfaces\SetMethodAliasInterface;
8
use TgBotApi\BotApiBase\Method\Traits\ChatIdVariableTrait;
9
use TgBotApi\BotApiBase\Type\ChatPermissionsType;
10
11
/**
12
 * Class SetChatPermissionsMethod.
13
 *
14
 * Use this method to set default chat permissions for all members.
15
 * The bot must be an administrator in the group or a supergroup
16
 * for this to work and must have the can_restrict_members admin rights. Returns True on success.
17
 *
18
 * @see https://core.telegram.org/bots/api#setchatpermissions
19
 */
20
class SetChatPermissionsMethod implements SetMethodAliasInterface
21
{
22
    use ChatIdVariableTrait;
23
24
    /**
25
     * @var ChatPermissionsType
26
     */
27
    public $permissions;
28
29
    /**
30
     * @param int|string          $chatId
31
     * @param ChatPermissionsType $permissions
32
     *
33
     * @return SetChatPermissionsMethod
34
     */
35 1
    public static function create($chatId, ChatPermissionsType $permissions): SetChatPermissionsMethod
36
    {
37 1
        $instance = new static();
38 1
        $instance->chatId = $chatId;
39 1
        $instance->permissions = $permissions;
40
41 1
        return $instance;
42
    }
43
}
44