Completed
Push — master ( 9f5987...1ab7f6 )
by Camilo
02:23
created

SetChatAdministratorCustomTitle::bindToObject()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 4
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace unreal4u\TelegramAPI\Telegram\Methods;
6
7
use Psr\Log\LoggerInterface;
8
use unreal4u\TelegramAPI\Abstracts\TelegramMethods;
9
use unreal4u\TelegramAPI\Abstracts\TelegramTypes;
10
use unreal4u\TelegramAPI\InternalFunctionality\TelegramResponse;
11
use unreal4u\TelegramAPI\Telegram\Types\Custom\ResultBoolean;
12
13
/**
14
 * Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on
15
 * success.
16
 *
17
 * Objects defined as-is June 2020, Bot API v4.9
18
 *
19
 * @see https://core.telegram.org/bots/api#setchatdescription
20
 */
21
class SetChatAdministratorCustomTitle extends TelegramMethods
22
{
23
    /**
24
     * Unique identifier for the target chat or username of the target supergroup or channel (in the format
25
     * @var string
26
     */
27
    public $chat_id = '';
28
29
    /**
30
     * Unique identifier of the target user
31
     * @var int
32
     */
33
    public $user_id = 0;
34
35
    /**
36
     * New custom title for the administrator; 0-16 characters, emoji are not allowed
37
     * @var string
38
     */
39
    public $custom_title;
40
41
    public static function bindToObject(TelegramResponse $data, LoggerInterface $logger): TelegramTypes
42
    {
43
        return new ResultBoolean($data->getResultBoolean(), $logger);
44
    }
45
46
    public function getMandatoryFields(): array
47
    {
48
        return [
49
            'chat_id',
50
            'user_id',
51
            'custom_title',
52
        ];
53
    }
54
}
55