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

InlineQueryResultCachedAudioType   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 13
dl 0
loc 53
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
11
/**
12
 * Class InlineQueryResultCachedAudioType.
13
 *
14
 * @see https://core.telegram.org/bots/api#inlinequeryresultcachedaudio
15
 */
16
class InlineQueryResultCachedAudioType extends InlineQueryResultType implements HasParseModeVariableInterface
17
{
18
    use FillFromArrayTrait;
19
20
    /**
21
     * A valid file identifier for the audio file.
22
     *
23
     * @var string
24
     */
25
    public $audioFileId;
26
27
    /**
28
     * Optional. Caption, 0-1024 characters.
29
     *
30
     * @var string|null
31
     */
32
    public $caption;
33
34
    /**
35
     * Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic,
36
     * fixed-width text or inline URLs in the media caption.
37
     *
38
     * @var string|null
39
     */
40
    public $parseMode;
41
42
    /**
43
     * Optional. Content of the message to be sent instead of the audio.
44
     *
45
     * @var InputMessageContentType|null
46
     */
47
    public $inputMessageContent;
48
49
    /**
50
     * @param string     $id
51
     * @param string     $audioFileId
52
     * @param array|null $data
53
     *
54
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
55
     *
56
     * @return InlineQueryResultCachedAudioType
57
     */
58
    public static function create(string $id, string $audioFileId, array $data = null): InlineQueryResultCachedAudioType
59
    {
60
        $instance = new static();
61
        $instance->type = self::TYPE_AUDIO;
62
        $instance->id = $id;
63
        $instance->audioFileId = $audioFileId;
64
        if ($data) {
65
            $instance->fill($data);
66
        }
67
68
        return $instance;
69
    }
70
}
71