Passed
Pull Request — master (#62)
by
unknown
11:14
created

GetChatMenuButtonMethod::create()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 4
c 1
b 0
f 1
dl 0
loc 8
rs 10
cc 2
nc 2
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Method;
6
7
use TgBotApi\BotApiBase\Method\Interfaces\MethodInterface;
8
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait;
9
10
/**
11
 * Class GetChatMenuButtonMethod.
12
 *
13
 * Use this method to get the current value of the bot's menu button in a private chat,
14
 * or the default menu button. Returns MenuButton on success.
15
 *
16
 * @see https://core.telegram.org/bots/api#getchatmenubutton
17
 */
18
class GetChatMenuButtonMethod implements MethodInterface
19
{
20
    use FillFromArrayTrait;
21
22
    /**
23
     * Optional. Unique identifier for the target private chat. If not specified, default bot's menu button will be returned.
24
     *
25
     * @var int|null
26
     */
27
    public $chatId;
28
29
    /**
30
     * GetChatMenuButtonMethod constructor.
31
     *
32
     * @param array|null $data
33
     *
34
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
35
     *
36
     * @return GetChatMenuButtonMethod
37
     */
38
    public static function create(array $data = null): GetChatMenuButtonMethod
39
    {
40
        $instance = new static();
41
        if ($data) {
42
            $instance->fill($data);
43
        }
44
45
        return $instance;
46
    }
47
}
48