InputMediaPhotoType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 8
dl 0
loc 22
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 10 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Type\InputMedia;
6
7
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait;
8
use TgBotApi\BotApiBase\Type\InputFileType;
9
10
/**
11
 * Class InputMediaPhotoType.
12
 *
13
 * @see https://core.telegram.org/bots/api#inputmediaphoto
14
 */
15
class InputMediaPhotoType extends InputMediaType
16
{
17
    use FillFromArrayTrait;
18
19
    /**
20
     * @param string|InputFileType $media
21
     * @param array|null           $data
22
     *
23
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
24
     *
25
     * @return InputMediaPhotoType
26
     */
27 1
    public static function create($media, array $data = null): InputMediaPhotoType
28
    {
29 1
        $instance = new static();
30 1
        $instance->media = $media;
31 1
        $instance->type = static::TYPE_PHOTO;
32 1
        if ($data) {
33 1
            $instance->fill($data);
34
        }
35
36 1
        return $instance;
37
    }
38
}
39