InlineQueryResultCachedGifType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 15
dl 0
loc 55
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\Interfaces\HasParseModeVariableInterface;
8
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait;
9
use TgBotApi\BotApiBase\Type\InputMessageContent\InputMessageContentType;
10
use TgBotApi\BotApiBase\Type\Traits\CaptionEntitiesFieldTrait;
11
12
/**
13
 * Class InlineQueryResultCachedGifType.
14
 *
15
 * Represents a link to an animated GIF file stored on the Telegram servers.
16
 * By default, this animated GIF file will be sent by the user with an optional caption.
17
 * Alternatively, you can use input_message_content to send a message with specified content instead of the animation.
18
 *
19
 * @see https://core.telegram.org/bots/api#inlinequeryresultcachedgif
20
 */
21
class InlineQueryResultCachedGifType extends InlineQueryResultType implements HasParseModeVariableInterface
22
{
23
    use CaptionEntitiesFieldTrait;
24
    use FillFromArrayTrait;
25
26
    /**
27
     * A valid file identifier for the GIF file.
28
     *
29
     * @var string
30
     */
31
    public $gifFileId;
32
33
    /**
34
     * Optional. Title for the result.
35
     *
36
     * @var string|null
37
     */
38
    public $title;
39
40
    /**
41
     * Optional. Caption of the GIF file to be sent, 0-1024 characters.
42
     *
43
     * @var string|null
44
     */
45
    public $caption;
46
47
    /**
48
     * Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic,
49
     * fixed-width text or inline URLs in the media caption.
50
     *
51
     * @var string|null
52
     */
53
    public $parseMode;
54
55
    /**
56
     * Optional. Content of the message to be sent instead of the GIF animation.
57
     *
58
     * @var InputMessageContentType|null
59
     */
60
    public $inputMessageContent;
61
62
    /**
63
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
64
     */
65
    public static function create(string $id, string $gifFileId, array $data = null): InlineQueryResultCachedGifType
66
    {
67
        $instance = new static();
68
        $instance->type = static::TYPE_GIF;
69
        $instance->id = $id;
70
        $instance->gifFileId = $gifFileId;
71
        if ($data) {
72
            $instance->fill($data);
73
        }
74
75
        return $instance;
76
    }
77
}
78