Sticker   A
last analyzed

Complexity

Total Complexity 33

Size/Duplication

Total Lines 430
Duplicated Lines 0 %

Test Coverage

Coverage 58.23%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 33
eloc 77
c 1
b 0
f 0
dl 0
loc 430
ccs 46
cts 79
cp 0.5823
rs 9.76

30 Methods

Rating   Name   Duplication   Size   Complexity  
A getFileId() 0 3 1
A getHeight() 0 3 1
A setHeight() 0 6 2
A getFileSize() 0 3 1
A setFileId() 0 3 1
A setFileSize() 0 6 2
A getCustomEmojiId() 0 3 1
A getFileUniqueId() 0 3 1
A getThumbnail() 0 3 1
A setFileUniqueId() 0 3 1
A setEmoji() 0 3 1
A setCustomEmojiId() 0 3 1
A getMaskPosition() 0 3 1
A getEmoji() 0 3 1
A getWidth() 0 3 1
A setSetName() 0 3 1
A getType() 0 3 1
A setWidth() 0 6 2
A setThumb() 0 3 1
A getPremiumAnimation() 0 3 1
A setIsVideo() 0 3 1
A getIsAnimated() 0 3 1
A setThumbnail() 0 3 1
A getThumb() 0 3 1
A setPremiumAnimation() 0 3 1
A getIsVideo() 0 3 1
A setIsAnimated() 0 3 1
A getSetName() 0 3 1
A setType() 0 3 1
A setMaskPosition() 0 3 1
1
<?php
2
3
namespace TelegramBot\Api\Types;
4
5
use TelegramBot\Api\BaseType;
6
use TelegramBot\Api\InvalidArgumentException;
7
use TelegramBot\Api\TypeInterface;
8
9
/**
10
 * Class Sticker
11
 * This object represents a sticker.
12
 *
13
 * @package TelegramBot\Api\Types
14
 */
15
class Sticker extends BaseType implements TypeInterface
16
{
17
    /**
18
     * {@inheritdoc}
19
     *
20
     * @var array
21
     */
22
    protected static $requiredParams = [
23
        'file_id',
24
        'file_unique_id',
25
        'type',
26
        'width',
27
        'height',
28
        'is_animated',
29
        'is_video'
30
    ];
31
32
    /**
33
     * {@inheritdoc}
34
     *
35
     * @var array
36
     */
37
    protected static $map = [
38
        'file_id' => true,
39
        'file_unique_id' => true,
40
        'type' => true,
41
        'width' => true,
42
        'height' => true,
43
        'is_animated' => true,
44
        'is_video' => true,
45
        'thumbnail' => PhotoSize::class,
46
        'file_size' => true,
47
        'premium_animation' => File::class,
48
        'emoji' => true,
49
        'set_name' => true,
50
        'mask_position' => MaskPosition::class,
51
        'custom_emoji_id' => true,
52
    ];
53
54
    /**
55
     * Unique identifier for this file
56
     *
57
     * @var string
58
     */
59
    protected $fileId;
60
61
    /**
62
     * Sticker width
63
     *
64
     * @var int
65
     */
66
    protected $width;
67
68
    /**
69
     * Sticker height
70
     *
71
     * @var int
72
     */
73
    protected $height;
74
75
    /**
76
     * 	Optional. Sticker thumbnail in the .WEBP or .JPG format
77
     *
78
     * @var PhotoSize|null
79
     */
80
    protected $thumbnail;
81
82
    /**
83
     * Optional. File size
84
     *
85
     * @var int|null
86
     */
87
    protected $fileSize;
88
89
    /**
90
     * Type of the sticker, currently one of “regular”, “mask”, “custom_emoji”.
91
     * The type of the sticker is independent from its format,
92
     * which is determined by the fields is_animated and is_video.
93
     *
94
     * @var string
95
     */
96
    protected $type;
97
98
    /**
99
     * Unique identifier for this file, which is supposed to be the same over time and for different bots.
100
     * Can't be used to download or reuse the file.
101
     *
102
     * @var string
103
     */
104
    protected $fileUniqueId;
105
106
    /**
107
     * Optional. For premium regular stickers, premium animation for the sticker
108
     *
109
     * @var File|null
110
     */
111
    protected $premiumAnimation;
112
113
    /**
114
     * True, if the sticker is animated
115
     *
116
     * @var bool
117
     */
118
    protected $isAnimated;
119
120
    /**
121
     * True, if the sticker is a video sticker
122
     *
123
     * @var bool
124
     */
125
    protected $isVideo;
126
127
    /**
128
     * Optional. Emoji associated with the sticker
129
     *
130
     * @var string|null
131
     */
132
    protected $emoji;
133
134
    /**
135
     * Optional. Name of the sticker set to which the sticker belongs
136
     *
137
     * @var string|null
138
     */
139
    protected $setName;
140
141
    /**
142
     * Optional. For mask stickers, the position where the mask should be placed
143
     *
144
     * @var MaskPosition|null
145
     */
146
    protected $maskPosition;
147
148
    /**
149
     * Optional. For custom emoji stickers, unique identifier of the custom emoji
150
     *
151
     * @var string|null
152
     */
153
    protected $customEmojiId;
154
155
    /**
156
     * @return string
157
     */
158 1
    public function getFileId()
159
    {
160 1
        return $this->fileId;
161
    }
162
163
    /**
164
     * @param string $fileId
165
     *
166 5
     * @return void
167
     */
168 5
    public function setFileId($fileId)
169 5
    {
170
        $this->fileId = $fileId;
171
    }
172
173
    /**
174 1
     * @return int|null
175
     */
176 1
    public function getFileSize()
177
    {
178
        return $this->fileSize;
179
    }
180
181
    /**
182
     * @param mixed $fileSize
183
     *
184 6
     * @throws InvalidArgumentException
185
     *
186 6
     * @return void
187 5
     */
188 5
    public function setFileSize($fileSize)
189 1
    {
190
        if (is_integer($fileSize)) {
191 5
            $this->fileSize = $fileSize;
192
        } else {
193
            throw new InvalidArgumentException();
194
        }
195
    }
196 1
197
    /**
198 1
     * @return int
199
     */
200
    public function getHeight()
201
    {
202
        return $this->height;
203
    }
204
205
    /**
206 6
     * @param mixed $height
207
     *
208 6
     * @throws InvalidArgumentException
209 5
     *
210 5
     * @return void
211 1
     */
212
    public function setHeight($height)
213 5
    {
214
        if (is_integer($height)) {
215
            $this->height = $height;
216
        } else {
217
            throw new InvalidArgumentException();
218 1
        }
219
    }
220 1
221
    /**
222
     * @return PhotoSize|null
223
     */
224
    public function getThumbnail()
225
    {
226 5
        return $this->thumbnail;
227
    }
228 5
229 5
    /**
230
     * @param PhotoSize $thumbnail
231
     *
232
     * @return void
233
     */
234 1
    public function setThumbnail(PhotoSize $thumbnail)
235
    {
236 1
        $this->thumbnail = $thumbnail;
237
    }
238
239
    /**
240
     * @deprecated use getThumbnail method
241
     *
242
     * @return PhotoSize|null
243
     */
244 6
    public function getThumb()
245
    {
246 6
        return $this->getThumbnail();
247 5
    }
248 5
249 1
    /**
250
     * @deprecated use setThumbnail method
251 5
     *
252
     * @param PhotoSize $thumb
253
     *
254
     * @return void
255
     */
256
    public function setThumb($thumb)
257
    {
258
        $this->setThumbnail($thumb);
259
    }
260
261
    /**
262
     * @return int
263
     */
264 3
    public function getWidth()
265
    {
266 3
        return $this->width;
267 3
    }
268
269
    /**
270
     * @param mixed $width
271
     *
272
     * @throws InvalidArgumentException
273
     *
274
     * @return void
275
     */
276
    public function setWidth($width)
277
    {
278
        if (is_integer($width)) {
279
            $this->width = $width;
280 3
        } else {
281
            throw new InvalidArgumentException();
282 3
        }
283 3
    }
284
285
    /**
286
     * @return string
287
     */
288
    public function getType()
289
    {
290
        return $this->type;
291
    }
292
293
    /**
294
     * @param string $type
295
     *
296
     * @return void
297
     */
298
    public function setType($type)
299
    {
300
        $this->type = $type;
301
    }
302
303
    /**
304
     * @return string
305
     */
306
    public function getFileUniqueId()
307
    {
308
        return $this->fileUniqueId;
309
    }
310
311
    /**
312 3
     * @param string $fileUniqueId
313
     *
314 3
     * @return void
315 3
     */
316
    public function setFileUniqueId($fileUniqueId)
317
    {
318
        $this->fileUniqueId = $fileUniqueId;
319
    }
320
321
    /**
322
     * @return File|null
323
     */
324
    public function getPremiumAnimation()
325
    {
326
        return $this->premiumAnimation;
327
    }
328 3
329
    /**
330 3
     * @param File $premiumAnimation
331 3
     *
332
     * @return void
333
     */
334
    public function setPremiumAnimation(File $premiumAnimation)
335
    {
336
        $this->premiumAnimation = $premiumAnimation;
337
    }
338
339
    /**
340
     * @return bool
341
     */
342
    public function getIsAnimated()
343
    {
344
        return $this->isAnimated;
345
    }
346
347
    /**
348
     * @param bool $isAnimated
349
     *
350
     * @return void
351
     */
352
    public function setIsAnimated($isAnimated)
353
    {
354
        $this->isAnimated = $isAnimated;
355
    }
356
357
    /**
358
     * @return bool
359
     */
360
    public function getIsVideo()
361
    {
362
        return $this->isVideo;
363
    }
364
365
    /**
366
     * @param bool $isVideo
367
     *
368
     * @return void
369
     */
370
    public function setIsVideo($isVideo)
371
    {
372
        $this->isVideo = $isVideo;
373
    }
374
375
    /**
376
     * @return null|string
377
     */
378
    public function getEmoji()
379
    {
380
        return $this->emoji;
381
    }
382
383
    /**
384
     * @param string $emoji
385
     *
386
     * @return void
387
     */
388
    public function setEmoji($emoji)
389
    {
390
        $this->emoji = $emoji;
391
    }
392
393
    /**
394
     * @return null|string
395
     */
396
    public function getSetName()
397
    {
398
        return $this->setName;
399
    }
400
401
    /**
402
     * @param string $setName
403
     *
404
     * @return void
405
     */
406
    public function setSetName($setName)
407
    {
408
        $this->setName = $setName;
409
    }
410
411
    /**
412
     * @return MaskPosition|null
413
     */
414
    public function getMaskPosition()
415
    {
416
        return $this->maskPosition;
417
    }
418
419
    /**
420
     * @param MaskPosition $maskPosition
421
     *
422
     * @return void
423
     */
424
    public function setMaskPosition(MaskPosition $maskPosition)
425
    {
426
        $this->maskPosition = $maskPosition;
427
    }
428
429
    /**
430
     * @return null|string
431
     */
432
    public function getCustomEmojiId()
433
    {
434
        return $this->customEmojiId;
435
    }
436
437
    /**
438
     * @param string $customEmojiId
439
     *
440
     * @return void
441
     */
442
    public function setCustomEmojiId($customEmojiId)
443
    {
444
        $this->customEmojiId = $customEmojiId;
445
    }
446
}
447