Passed
Push — master ( c05883...1d5c29 )
by Nikolay
02:30
created

InlineQueryResultArticleType   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 85
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 18
dl 0
loc 85
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 16 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Type\InlineQueryResult;
6
7
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait;
8
use TgBotApi\BotApiBase\Type\InputMessageContent\InputMessageContentType;
9
10
/**
11
 * Class InlineQueryResultArticleType.
12
 *
13
 * @see https://core.telegram.org/bots/api#inlinequeryresultarticle
14
 */
15
class InlineQueryResultArticleType extends InlineQueryResultType
16
{
17
    use FillFromArrayTrait;
18
    /**
19
     * Title of the result.
20
     *
21
     * @var string
22
     */
23
    public $title;
24
25
    /**
26
     * Content of the message to be sent.
27
     *
28
     * @var InputMessageContentType
29
     */
30
    public $inputMessageContent;
31
32
    /**
33
     * Optional. URL of the result.
34
     *
35
     * @var string|null
36
     */
37
    public $url;
38
39
    /**
40
     * Optional. Pass True, if you don't want the URL to be shown in the message.
41
     *
42
     * @var bool|null
43
     */
44
    public $hideUrl;
45
46
    /**
47
     * Optional. Short description of the result.
48
     *
49
     * @var string|null
50
     */
51
    public $description;
52
53
    /**
54
     * Optional. Url of the thumbnail for the result.
55
     *
56
     * @var string|null
57
     */
58
    public $thumbUrl;
59
60
    /**
61
     * Optional. Thumbnail width.
62
     *
63
     * @var int|null
64
     */
65
    public $thumbWidth;
66
67
    /**
68
     * Optional. Thumbnail height.
69
     *
70
     * @var int|null
71
     */
72
    public $thumbHeight;
73
74
    /**
75
     * @param string                  $id
76
     * @param string                  $title
77
     * @param InputMessageContentType $inputMessageContent
78
     * @param array|null              $data
79
     *
80
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
81
     *
82
     * @return InlineQueryResultArticleType
83
     */
84
    public static function create(
85
        string $id,
86
        string $title,
87
        InputMessageContentType $inputMessageContent,
88
        array $data = null
89
    ): InlineQueryResultArticleType {
90
        $instance = new static();
91
        $instance->type = self::TYPE_ARTICLE;
92
        $instance->id = $id;
93
        $instance->title = $title;
94
        $instance->inputMessageContent = $inputMessageContent;
95
        if ($data) {
96
            $instance->fill($data);
97
        }
98
99
        return $instance;
100
    }
101
}
102