SetChatDescriptionMethod   A
last analyzed

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\Interfaces\SetMethodAliasInterface;
8
use TgBotApi\BotApiBase\Method\Traits\ChatIdVariableTrait;
9
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait;
10
11
/**
12
 * Class SetChatDescriptionMethod.
13
 *
14
 * @see https://core.telegram.org/bots/api#setchatdescription
15
 */
16
class SetChatDescriptionMethod implements SetMethodAliasInterface
17
{
18
    use FillFromArrayTrait;
19
    use ChatIdVariableTrait;
20
21
    /**
22
     * Optional. New chat description, 0-255 characters.
23
     *
24
     * @var string|null
25
     */
26
    public $description;
27
28
    /**
29
     * @param int|string $chatId
30
     * @param array|null $data
31
     *
32
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
33
     *
34
     * @return SetChatDescriptionMethod
35
     */
36 3
    public static function create($chatId, array $data = null): SetChatDescriptionMethod
37
    {
38 3
        $instance = new static();
39 3
        $instance->chatId = $chatId;
40 3
        if ($data) {
41 3
            $instance->fill($data, ['chatId']);
42
        }
43
44 1
        return $instance;
45
    }
46
}
47