SendVoiceMethod   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
wmc 2
eloc 10
dl 0
loc 37
ccs 4
cts 5
cp 0.8
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Greenplugin\TelegramBot\Method;
6
7
use Greenplugin\TelegramBot\Method\Interfaces\HasParseModeVariableInterface;
8
use Greenplugin\TelegramBot\Method\Traits\CaptionVariablesTrait;
9
use Greenplugin\TelegramBot\Method\Traits\FillFromArrayTrait;
10
use Greenplugin\TelegramBot\Method\Traits\SendToChatVariablesTrait;
11
use Greenplugin\TelegramBot\Type\InputFileType;
12
13
/**
14
 * Class SendVoiceMethod.
15
 *
16
 * @see https://core.telegram.org/bots/api#sendvoice
17
 */
18
class SendVoiceMethod implements HasParseModeVariableInterface
19
{
20
    use FillFromArrayTrait;
21
    use SendToChatVariablesTrait;
22
    use CaptionVariablesTrait;
23
24
    /**
25
     * Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended),
26
     * pass an HTTP URL as a String for Telegram to get a file from the Internet,
27
     * or upload a new one using multipart/form-data.
28
     *
29
     * @var InputFileType|string
30
     */
31
    public $voice;
32
33
    /**
34
     * Optional Duration of the voice message in seconds.
35
     *
36
     * @var string|null
37
     */
38
    public $duration;
39
40
    /**
41
     * SendVoiceMethod constructor.
42
     *
43
     * @param int|string           $chatId
44
     * @param InputFileType|string $voice
45
     * @param array|null           $data
46
     *
47
     * @throws \Greenplugin\TelegramBot\Exception\BadArgumentException
48
     */
49 1
    public function __construct($chatId, $voice, array $data = null)
50
    {
51 1
        $this->chatId = $chatId;
52 1
        $this->voice = $voice;
53 1
        if ($data) {
54
            $this->fill($data);
55
        }
56 1
    }
57
}
58