Completed
Pull Request — master (#1)
by Nikolay
02:25
created

KickChatMemberMethod::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 3
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Greenplugin\TelegramBot\Method;
6
7
use Greenplugin\TelegramBot\Method\Traits\ChatIdVariableTrait;
8
use Greenplugin\TelegramBot\Method\Traits\FillFromArrayTrait;
9
use Greenplugin\TelegramBot\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 \Greenplugin\TelegramBot\Exception\BadArgumentException
38
     */
39 1
    public function __construct($chatId, int $userId, array $data = null)
40
    {
41 1
        $this->chatId = $chatId;
42 1
        $this->userId = $userId;
43 1
        if ($data) {
44 1
            $this->fill($data);
45
        }
46 1
    }
47
}
48