Passed
Push — master ( c05883...1d5c29 )
by Nikolay
02:30
created

SendGameMethod   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 13
dl 0
loc 52
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 10 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Method;
6
7
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait;
8
use TgBotApi\BotApiBase\Method\Traits\ReplyMarkupVariableTrait;
9
10
/**
11
 * Class SendGameType.
12
 *
13
 * @see https://core.telegram.org/bots/api#sendgame
14
 */
15
class SendGameMethod
16
{
17
    use FillFromArrayTrait;
18
    use ReplyMarkupVariableTrait;
19
20
    /**
21
     * Unique identifier for the target chat.
22
     *
23
     * @var int
24
     */
25
    public $chatId;
26
27
    /**
28
     * Short name of the game, serves as the unique identifier for the game. Set up your games via Botfather.
29
     *
30
     * @var string
31
     */
32
    public $gameShortName;
33
34
    /**
35
     * Sends the message silently. Users will receive a notification with no sound.
36
     *
37
     * @var bool|null
38
     */
39
    public $disableNotification;
40
41
    /**
42
     * If the message is a reply, ID of the original message.
43
     *
44
     * @var int|null
45
     */
46
    public $replyToMessageId;
47
48
    /**
49
     * @param int        $chatId
50
     * @param string     $gameShortName
51
     * @param array|null $data
52
     *
53
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
54
     *
55
     * @return SendGameMethod
56
     */
57
    public static function create(int $chatId, string $gameShortName, array $data = null): SendGameMethod
58
    {
59
        $instance = new static();
60
        $instance->chatId = $chatId;
61
        $instance->gameShortName = $gameShortName;
62
        if ($data) {
63
            $instance->fill($data);
64
        }
65
66
        return $instance;
67
    }
68
}
69