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

InlineQueryResultAudioType   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 16 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 InlineQueryResultAudio.
13
 *
14
 * @see https://core.telegram.org/bots/api#inlinequeryresultaudio
15
 */
16
class InlineQueryResultAudioType extends InlineQueryResultType implements HasParseModeVariableInterface
17
{
18
    use FillFromArrayTrait;
19
    /**
20
     * A valid URL for the audio file.
21
     *
22
     * @var string
23
     */
24
    public $audioUrl;
25
26
    /**
27
     * Title.
28
     *
29
     * @var string
30
     */
31
    public $title;
32
33
    /**
34
     * Optional. Caption, 0-1024 characters.
35
     *
36
     * @var string|null
37
     */
38
    public $caption;
39
40
    /**
41
     * Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic,
42
     * fixed-width text or inline URLs in the media caption.
43
     *
44
     * @var string|null
45
     */
46
    public $parseMode;
47
48
    /**
49
     * Optional. Performer.
50
     *
51
     * @var string|null
52
     */
53
    public $performer;
54
55
    /**
56
     * Optional. Audio duration in seconds.
57
     *
58
     * @var int|null
59
     */
60
    public $audioDuration;
61
62
    /**
63
     * Optional. Content of the message to be sent instead of the audio.
64
     *
65
     * @var InputMessageContentType|null
66
     */
67
    public $inputMessageContent;
68
69
    /**
70
     * @param string     $id
71
     * @param string     $audioUrl
72
     * @param string     $title
73
     * @param array|null $data
74
     *
75
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
76
     *
77
     * @return InlineQueryResultAudioType
78
     */
79
    public static function create(
80
        string $id,
81
        string $audioUrl,
82
        string $title,
83
        array $data = null
84
    ): InlineQueryResultAudioType {
85
        $instance = new static();
86
        $instance->type = self::TYPE_AUDIO;
87
        $instance->id = $id;
88
        $instance->audioUrl = $audioUrl;
89
        $instance->title = $title;
90
        if ($data) {
91
            $instance->fill($data);
92
        }
93
94
        return $instance;
95
    }
96
}
97