SendMediaGroupMethod::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.032

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
ccs 4
cts 5
cp 0.8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 3
crap 2.032
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