InlineQueryResultGameType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 11 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Type\InlineQueryResult;
6
7
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait;
8
9
/**
10
 * Class InlineQueryResultGameType.
11
 *
12
 * @see https://core.telegram.org/bots/api#inlinequeryresultgame
13
 */
14
class InlineQueryResultGameType extends InlineQueryResultType
15
{
16
    use FillFromArrayTrait;
17
18
    /**
19
     * Short name of the game.
20
     *
21
     * @var string
22
     */
23
    public $gameShortName;
24
25
    /**
26
     * @param string     $id
27
     * @param string     $gameShortName
28
     * @param array|null $data
29
     *
30
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
31
     *
32
     * @return InlineQueryResultGameType
33
     */
34
    public static function create(string $id, string $gameShortName, array $data = null): InlineQueryResultGameType
35
    {
36
        $instance = new static();
37
        $instance->type = static::TYPE_GAME;
38
        $instance->id = $id;
39
        $instance->gameShortName = $gameShortName;
40
        if ($data) {
41
            $instance->fill($data);
42
        }
43
44
        return $instance;
45
    }
46
}
47