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

SendMediaGroupMethod   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
wmc 2
eloc 8
dl 0
loc 26
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\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