Passed
Push — master ( 1b1236...bd5fab )
by Nikolay
01:00 queued 15s
created

SetMyCommandsMethod   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
eloc 5
c 1
b 0
f 1
dl 0
loc 19
ccs 4
cts 4
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 6 1
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\Type\BotCommandType;
9
10
/**
11
 * Class SetMyCommandsMethod.
12
 *
13
 * Use this method to change the list of the bot's commands. Returns True on success.
14
 *
15
 * @see https://core.telegram.org/bots/api#setmycommands
16
 */
17
class SetMyCommandsMethod implements SetMethodAliasInterface
18
{
19
    /**
20
     * A JSON-serialized list of bot commands to be set as the list of the bot's commands.
21
     * At most 100 commands can be specified.
22
     *
23
     * @var BotCommandType[]
24
     */
25
    public $commands;
26
27
    /**
28
     * @param BotCommandType[] $commands
29
     */
30 1
    public static function create(array $commands): SetMyCommandsMethod
31
    {
32 1
        $instance = new static();
33 1
        $instance->commands = $commands;
34
35 1
        return $instance;
36
    }
37
}
38