Completed
Push — master ( e9eebf...b866da )
by Gusev
03:01
created

Article   A

Complexity

Total Complexity 13

Size/Duplication

Total Lines 211
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 13
c 2
b 0
f 0
lcom 0
cbo 1
dl 0
loc 211
rs 10

13 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 21 1
A getUrl() 0 4 1
A setUrl() 0 4 1
A isHideUrl() 0 4 1
A setHideUrl() 0 4 1
A getDescription() 0 4 1
A setDescription() 0 4 1
A getThumbUrl() 0 4 1
A setThumbUrl() 0 4 1
A getThumbWidth() 0 4 1
A setThumbWidth() 0 4 1
A getThumbHeight() 0 4 1
A setThumbHeight() 0 4 1
1
<?php
2
3
namespace TelegramBot\Api\Types\Inline\QueryResult;
4
5
use TelegramBot\Api\Types\Inline\InlineKeyboardMarkup;
6
use TelegramBot\Api\Types\Inline\InputMessageContent;
7
8
/**
9
 * Class InlineQueryResultArticle
10
 * Represents a link to an article or web page.
11
 *
12
 * @package TelegramBot\Api\Types\Inline
13
 */
14
class Article extends AbstractInlineQueryResult
15
{
16
    /**
17
     * {@inheritdoc}
18
     *
19
     * @var array
20
     */
21
    static protected $requiredParams = ['type', 'id', 'title', 'input_message_content'];
22
23
    /**
24
     * {@inheritdoc}
25
     *
26
     * @var array
27
     */
28
    static protected $map = [
29
        'type' => true,
30
        'id' => true,
31
        'title' => true,
32
        'input_message_content' => InputMessageContent::class,
33
        'reply_markup' => InlineKeyboardMarkup::class,
34
        'disable_web_page_preview' => true,
35
        'url' => true,
36
        'hide_url' => true,
37
        'description' => true,
38
        'thumb_url' => true,
39
        'thumb_width' => true,
40
        'thumb_height' => true,
41
    ];
42
43
    /**
44
     * {@inheritdoc}
45
     *
46
     * @var string
47
     */
48
    protected $type = 'article';
49
50
    /**
51
     * Optional. URL of the result
52
     *
53
     * @var string
54
     */
55
    protected $url;
56
57
    /**
58
     * Optional. Pass True, if you don't want the URL to be shown in the message
59
     *
60
     * @var bool
61
     */
62
    protected $hideUrl;
63
64
    /**
65
     * Optional. Short description of the result
66
     *
67
     * @var string
68
     */
69
    protected $description;
70
71
    /**
72
     * Optional. Url of the thumbnail for the result
73
     *
74
     * @var string
75
     */
76
    protected $thumbUrl;
77
78
    /**
79
     * Optional. Thumbnail width
80
     *
81
     * @var int
82
     */
83
    protected $thumbWidth;
84
85
    /**
86
     * Optional. Thumbnail height
87
     *
88
     * @var int
89
     */
90
    protected $thumbHeight;
91
92
    /**
93
     * InlineQueryResultArticle constructor.
94
     *
95
     * @param string $id
96
     * @param string $title
97
     * @param InputMessageContent $inputMessageContent
98
     * @param InlineKeyboardMarkup|null $inlineKeyboardMarkup
99
     * @param string|null $url
100
     * @param bool $hideUrl
101
     * @param string|null $description
102
     * @param string|null $thumbUrl
103
     * @param int|null $thumbWidth
104
     * @param int|null $thumbHeight
105
     */
106
    public function __construct(
107
        $id,
108
        $title,
109
        $inputMessageContent,
110
        $inlineKeyboardMarkup = null,
111
        $url = null,
112
        $hideUrl = false,
113
        $description = null,
114
        $thumbUrl = null,
115
        $thumbWidth = null,
116
        $thumbHeight = null
117
    ) {
118
        parent::__construct($id, $title, $inputMessageContent, $inlineKeyboardMarkup);
119
120
        $this->url = $url;
121
        $this->hideUrl = $hideUrl;
122
        $this->description = $description;
123
        $this->thumbUrl = $thumbUrl;
124
        $this->thumbWidth = $thumbWidth;
125
        $this->thumbHeight = $thumbHeight;
126
    }
127
128
129
    /**
130
     * @return string
131
     */
132
    public function getUrl()
133
    {
134
        return $this->url;
135
    }
136
137
    /**
138
     * @param string $url
139
     */
140
    public function setUrl($url)
141
    {
142
        $this->url = $url;
143
    }
144
145
    /**
146
     * @return boolean
147
     */
148
    public function isHideUrl()
149
    {
150
        return $this->hideUrl;
151
    }
152
153
    /**
154
     * @param boolean $hideUrl
155
     */
156
    public function setHideUrl($hideUrl)
157
    {
158
        $this->hideUrl = $hideUrl;
159
    }
160
161
    /**
162
     * @return string
163
     */
164
    public function getDescription()
165
    {
166
        return $this->description;
167
    }
168
169
    /**
170
     * @param string $description
171
     */
172
    public function setDescription($description)
173
    {
174
        $this->description = $description;
175
    }
176
177
    /**
178
     * @return string
179
     */
180
    public function getThumbUrl()
181
    {
182
        return $this->thumbUrl;
183
    }
184
185
    /**
186
     * @param string $thumbUrl
187
     */
188
    public function setThumbUrl($thumbUrl)
189
    {
190
        $this->thumbUrl = $thumbUrl;
191
    }
192
193
    /**
194
     * @return int
195
     */
196
    public function getThumbWidth()
197
    {
198
        return $this->thumbWidth;
199
    }
200
201
    /**
202
     * @param int $thumbWidth
203
     */
204
    public function setThumbWidth($thumbWidth)
205
    {
206
        $this->thumbWidth = $thumbWidth;
207
    }
208
209
    /**
210
     * @return int
211
     */
212
    public function getThumbHeight()
213
    {
214
        return $this->thumbHeight;
215
    }
216
217
    /**
218
     * @param int $thumbHeight
219
     */
220
    public function setThumbHeight($thumbHeight)
221
    {
222
        $this->thumbHeight = $thumbHeight;
223
    }
224
}
225