Completed
Push — master ( a4a0d7...5dd6ba )
by Camilo
07:16
created

KickChatMember::getMandatoryFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 4
nc 1
nop 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\TelegramRawData;
11
use unreal4u\TelegramAPI\Telegram\Types\Custom\ResultBoolean;
12
13
/**
14
 * Use this method to kick a user from a group or a supergroup. In the case of supergroups, the user will not be able to
15
 * return to the group on their own using invite links, etc., unless unbanned first. The bot must be an administrator in
16
 * the group for this to work. Returns True on success.
17
 *
18
 * Note: This will method only work if the ‘All Members Are Admins’ setting is off in the target group. Otherwise
19
 * members may only be removed by the group's creator or by the member that added them.
20
 *
21
 * Objects defined as-is july 2016
22
 *
23
 * @see https://core.telegram.org/bots/api#kickchatmember
24
 */
25
class KickChatMember extends TelegramMethods
26
{
27
    /**
28
     * Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername)
29
     * @var string
30
     */
31
    public $chat_id = '';
32
33
    /**
34
     * Unique identifier of the target user
35
     * @var int
36
     */
37
    public $user_id = 0;
38
39
    public static function bindToObject(TelegramRawData $data, LoggerInterface $logger): TelegramTypes
40
    {
41
        return new ResultBoolean($data->getResultBoolean(), $logger);
42
    }
43
44
    public function getMandatoryFields(): array
45
    {
46
        return [
47
            'chat_id',
48
            'user_id',
49
        ];
50
    }
51
}
52