Completed
Push — master ( d60737...066901 )
by Nikolay
19s queued 12s
created

GetChatMenuButtonMethod   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 7
c 1
b 0
f 1
dl 0
loc 28
rs 10

1 Method

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