Passed
Push — master ( 96ab76...3ce77f )
by Nikolay
01:27 queued 10s
created

SetChatAdministratorCustomTitleMethod::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 8
c 1
b 0
f 0
ccs 6
cts 6
cp 1
rs 10
cc 1
nc 1
nop 3
crap 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\Method\Traits\UserIdVariableTrait;
10
11
/**
12
 * Use this method to set a custom title
13
 * for an administrator in a supergroup promoted by the bot. Returns True on success.
14
 *
15
 * @see https://core.telegram.org/bots/api#setchatadministratorcustomtitle
16
 */
17
class SetChatAdministratorCustomTitleMethod implements SetMethodAliasInterface
18
{
19
    use ChatIdVariableTrait;
20
    use UserIdVariableTrait;
21
22
    /**
23
     * @var string
24
     */
25
    public $customTitle;
26
27
    /**
28
     * @param int|string $chatId
29
     */
30 1
    public static function create($chatId, int $userId, string $title): SetChatAdministratorCustomTitleMethod
31
    {
32 1
        $instance = new static();
33 1
        $instance->chatId = $chatId;
34 1
        $instance->userId = $userId;
35 1
        $instance->customTitle = $title;
36
37 1
        return $instance;
38
    }
39
}
40