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

SetChatDescriptionMethod   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 9
dl 0
loc 29
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 9 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