Completed
Push — master ( 7d37a2...fea370 )
by Nikolay
06:21
created

SendMediaGroupMethod::__construct()   A

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\FillFromArrayTrait;
8
use Greenplugin\TelegramBot\Method\Traits\SendToChatVariablesTrait;
9
use Greenplugin\TelegramBot\Type\InputMediaPhotoType;
10
use Greenplugin\TelegramBot\Type\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 SendToChatVariablesTrait;
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
     * SendGroupMethod constructor.
30
     *
31
     * @param int|string                                  $chatId
32
     * @param InputMediaPhotoType[]|InputMediaVideoType[] $media
33
     * @param array|null                                  $data
34
     *
35
     * @throws \Greenplugin\TelegramBot\Exception\BadArgumentException
36
     */
37 3
    public function __construct($chatId, $media, array $data = null)
38
    {
39 3
        $this->chatId = $chatId;
40 3
        $this->media = $media;
41 3
        if ($data) {
42
            $this->fill($data);
43
        }
44 3
    }
45
}
46