SendMediaGroupMethod   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
wmc 2
eloc 10
dl 0
loc 40
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\Traits\ChatIdVariableTrait;
8
use Greenplugin\TelegramBot\Method\Traits\FillFromArrayTrait;
9
use Greenplugin\TelegramBot\Type\InputMedia\InputMediaPhotoType;
10
use Greenplugin\TelegramBot\Type\InputMedia\InputMediaVideoType;
11
12
/**
13
 * Class SendMediaGroupMethod.
14
 *
15
 * @see https://core.telegram.org/bots/api#sendmediagroup
16
 */
17
class SendMediaGroupMethod
18
{
19
    use FillFromArrayTrait;
20
    use ChatIdVariableTrait;
21
    /**
22
     * A JSON-serialized array describing photos and videos to be sent, must include 2–10 items.
23
     *
24
     * @var InputMediaPhotoType[]|InputMediaVideoType[]
25
     */
26
    public $media;
27
28
    /**
29
     * Optional. Sends the message silently. Users will receive a notification with no sound.
30
     *
31
     * @var bool|null
32
     */
33
    public $disableNotification;
34
35
    /**
36
     * Optional. If the message is a reply, ID of the original message.
37
     *
38
     * @var int|null
39
     */
40
    public $replyToMessageId;
41
42
    /**
43
     * SendGroupMethod constructor.
44
     *
45
     * @param int|string                                  $chatId
46
     * @param InputMediaPhotoType[]|InputMediaVideoType[] $media
47
     * @param array|null                                  $data
48
     *
49
     * @throws \Greenplugin\TelegramBot\Exception\BadArgumentException
50
     */
51 1
    public function __construct($chatId, $media, array $data = null)
52
    {
53 1
        $this->chatId = $chatId;
54 1
        $this->media = $media;
55 1
        if ($data) {
56
            $this->fill($data);
57
        }
58 1
    }
59
}
60