KickChatMemberMethod   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 11
dl 0
loc 35
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 10 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Method;
6
7
use TgBotApi\BotApiBase\Method\Interfaces\KickMethodAliasInterface;
8
use TgBotApi\BotApiBase\Method\Traits\ChatIdVariableTrait;
9
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait;
10
use TgBotApi\BotApiBase\Method\Traits\UserIdVariableTrait;
11
12
/**
13
 * Class KickChatMemberMethod.
14
 *
15
 * @see https://core.telegram.org/bots/api#kickchatmember
16
 */
17
class KickChatMemberMethod implements KickMethodAliasInterface
18
{
19
    use FillFromArrayTrait;
20
    use ChatIdVariableTrait;
21
    use UserIdVariableTrait;
22
    /**
23
     * Optional. Date when the user will be unbanned, \DateTimeInterface.
24
     * If user is banned for more than 366 days or less than 30 seconds
25
     * from the current time they are considered to be banned forever.
26
     *
27
     * @var \DateTimeInterface|null
28
     */
29
    public $untilDate;
30
31
    /**
32
     * KickChatMemberMethod constructor.
33
     *
34
     * @param int|string $chatId
35
     * @param int        $userId
36
     * @param array|null $data
37
     *
38
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
39
     *
40
     * @return KickChatMemberMethod
41
     */
42 1
    public static function create($chatId, int $userId, array $data = null): KickChatMemberMethod
43
    {
44 1
        $instance = new static();
45 1
        $instance->chatId = $chatId;
46 1
        $instance->userId = $userId;
47 1
        if ($data) {
48 1
            $instance->fill($data);
49
        }
50
51 1
        return $instance;
52
    }
53
}
54