Passed
Pull Request — master (#28)
by Nikolay
03:06
created

SetMyCommandsMethod::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 3
c 1
b 0
f 1
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 10
cc 1
nc 1
nop 1
crap 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