InlineQueryResultCachedPhotoType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 16
dl 0
loc 61
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 11 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Type\InlineQueryResult;
6
7
use TgBotApi\BotApiBase\Method\Interfaces\HasParseModeVariableInterface;
8
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait;
9
use TgBotApi\BotApiBase\Type\InputMessageContent\InputMessageContentType;
10
use TgBotApi\BotApiBase\Type\Traits\CaptionEntitiesFieldTrait;
11
12
/**
13
 * Class InlineQueryResultCachedPhotoType.
14
 *
15
 * @see https://core.telegram.org/bots/api#inlinequeryresultcachedphoto
16
 */
17
class InlineQueryResultCachedPhotoType extends InlineQueryResultType implements HasParseModeVariableInterface
18
{
19
    use CaptionEntitiesFieldTrait;
20
    use FillFromArrayTrait;
21
22
    /**
23
     * A valid file identifier of the photo.
24
     *
25
     * @var string
26
     */
27
    public $photoFileId;
28
    /**
29
     * Optional. Title for the result.
30
     *
31
     * @var string|null
32
     */
33
    public $title;
34
35
    /**
36
     * Optional. Short description of the result.
37
     *
38
     * @var string|null
39
     */
40
    public $description;
41
42
    /**
43
     * Optional. Caption of the photo to be sent, 0-1024 characters.
44
     *
45
     * @var string|null
46
     */
47
    public $caption;
48
49
    /**
50
     * Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic,
51
     * fixed-width text or inline URLs in the media caption.
52
     *
53
     * @var string|null
54
     */
55
    public $parseMode;
56
57
    /**
58
     * Optional. Content of the message to be sent instead of the photo.
59
     *
60
     * @var InputMessageContentType|null
61
     */
62
    public $inputMessageContent;
63
64
    /**
65
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
66
     */
67
    public static function create(string $id, string $photoFileId, array $data = null): InlineQueryResultCachedPhotoType
68
    {
69
        $instance = new static();
70
        $instance->type = static::TYPE_PHOTO;
71
        $instance->id = $id;
72
        $instance->photoFileId = $photoFileId;
73
        if ($data) {
74
            $instance->fill($data);
75
        }
76
77
        return $instance;
78
    }
79
}
80