InlineQueryResultCachedGifType::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

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