Passed
Push — master ( c05883...1d5c29 )
by Nikolay
02:30
created

KickChatMemberMethod   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

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