Completed
Push — master ( 4b7fdd...026556 )
by Nikolay
02:45
created

SetChatDescriptionMethod::create()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 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
10
/**
11
 * Class SetChatDescriptionMethod.
12
 *
13
 * @see https://core.telegram.org/bots/api#setchatdescription
14
 */
15
class SetChatDescriptionMethod
16
{
17
    use FillFromArrayTrait;
18
    use ChatIdVariableTrait;
19
20
    /**
21
     * Optional. New chat description, 0-255 characters.
22
     *
23
     * @var string|null
24
     */
25
    public $description;
26
27
    /**
28
     * @param int|string $chatId
29
     * @param array|null $data
30
     *
31
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
32
     *
33
     * @return SetChatDescriptionMethod
34
     */
35 1
    public static function create($chatId, array $data = null): SetChatDescriptionMethod
36
    {
37 1
        $instance = new static();
38 1
        $instance->chatId = $chatId;
39 1
        if ($data) {
40 1
            $instance->fill($data);
41
        }
42
43 1
        return $instance;
44
    }
45
}
46