Passed
Pull Request — master (#408)
by Alexander
02:08 queued 28s
created

Sticker::setThumb()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 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
    static protected $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
    static protected $map = [
38
        'file_id' => true,
39
        'width' => true,
40
        'height' => true,
41
        'thumb' => PhotoSize::class,
42
        'file_size' => true,
43
        'type' => true,
44
        'file_unique_id' => true,
45
        'premium_animation' => true,
46
        'is_animated' => true,
47
        'is_video' => true,
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
79
     */
80
    protected $thumb;
81
82
    /**
83
     * Optional. File size
84
     *
85
     * @var int
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
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
131
     */
132
    protected $emoji;
133
134
    /**
135
     * Optional. Name of the sticker set to which the sticker belongs
136
     *
137
     * @var string
138
     */
139
    protected $setName;
140
141
    /**
142
     * Optional. For mask stickers, the position where the mask should be placed
143
     *
144
     * @var MaskPosition
145
     */
146
    protected $maskPosition;
147
148
    /**
149
     * Optional. For custom emoji stickers, unique identifier of the custom emoji
150
     *
151
     * @var string
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
    public function setFileId($fileId)
167
    {
168 5
        $this->fileId = $fileId;
169 5
    }
170
171
    /**
172
     * @return int
173
     */
174 1
    public function getFileSize()
175
    {
176 1
        return $this->fileSize;
177
    }
178
179
    /**
180
     * @param int $fileSize
181
     *
182
     * @throws InvalidArgumentException
183
     */
184 6
    public function setFileSize($fileSize)
185
    {
186 6
        if (is_integer($fileSize)) {
0 ignored issues
show
introduced by
The condition is_integer($fileSize) is always true.
Loading history...
187 5
            $this->fileSize = $fileSize;
188 5
        } else {
189 1
            throw new InvalidArgumentException();
190
        }
191 5
    }
192
193
    /**
194
     * @return int
195
     */
196 1
    public function getHeight()
197
    {
198 1
        return $this->height;
199
    }
200
201
    /**
202
     * @param int $height
203
     *
204
     * @throws InvalidArgumentException
205
     */
206 6
    public function setHeight($height)
207
    {
208 6
        if (is_integer($height)) {
0 ignored issues
show
introduced by
The condition is_integer($height) is always true.
Loading history...
209 5
            $this->height = $height;
210 5
        } else {
211 1
            throw new InvalidArgumentException();
212
        }
213 5
    }
214
215
    /**
216
     * @return PhotoSize
217
     */
218 1
    public function getThumb()
219
    {
220 1
        return $this->thumb;
221
    }
222
223
    /**
224
     * @param PhotoSize $thumb
225
     */
226 5
    public function setThumb(PhotoSize $thumb)
227
    {
228 5
        $this->thumb = $thumb;
229 5
    }
230
231
    /**
232
     * @return int
233
     */
234 1
    public function getWidth()
235
    {
236 1
        return $this->width;
237
    }
238
239
    /**
240
     * @param int $width
241
     *
242
     * @throws InvalidArgumentException
243
     */
244 6
    public function setWidth($width)
245
    {
246 6
        if (is_integer($width)) {
0 ignored issues
show
introduced by
The condition is_integer($width) is always true.
Loading history...
247 5
            $this->width = $width;
248 5
        } else {
249 1
            throw new InvalidArgumentException();
250
        }
251 5
    }
252
253
    /**
254
     * @return string
255
     */
256
    public function getType()
257
    {
258
        return $this->type;
259
    }
260
261
    /**
262
     * @param string $type
263
     */
264 3
    public function setType($type)
265
    {
266 3
        $this->type = $type;
267 3
    }
268
269
    /**
270
     * @return string
271
     */
272
    public function getFileUniqueId()
273
    {
274
        return $this->fileUniqueId;
275
    }
276
277
    /**
278
     * @param string $fileUniqueId
279
     */
280 3
    public function setFileUniqueId($fileUniqueId)
281
    {
282 3
        $this->fileUniqueId = $fileUniqueId;
283 3
    }
284
285
    /**
286
     * @return File
287
     */
288
    public function getPremiumAnimation()
289
    {
290
        return $this->premiumAnimation;
291
    }
292
293
    /**
294
     * @param File $premiumAnimation
295
     */
296
    public function setPremiumAnimation(File $premiumAnimation)
297
    {
298
        $this->premiumAnimation = $premiumAnimation;
299
    }
300
301
    /**
302
     * @return bool
303
     */
304
    public function getIsAnimated()
305
    {
306
        return $this->isAnimated;
307
    }
308
309
    /**
310
     * @param bool $isAnimated
311
     */
312 3
    public function setIsAnimated($isAnimated)
313
    {
314 3
        $this->isAnimated = $isAnimated;
315 3
    }
316
317
    /**
318
     * @return bool
319
     */
320
    public function getIsVideo()
321
    {
322
        return $this->isVideo;
323
    }
324
325
    /**
326
     * @param bool $isVideo
327
     */
328 3
    public function setIsVideo($isVideo)
329
    {
330 3
        $this->isVideo = $isVideo;
331 3
    }
332
333
    /**
334
     * @return string
335
     */
336
    public function getEmoji()
337
    {
338
        return $this->emoji;
339
    }
340
341
    /**
342
     * @param string $emoji
343
     */
344
    public function setEmoji($emoji)
345
    {
346
        $this->emoji = $emoji;
347
    }
348
349
    /**
350
     * @return string
351
     */
352
    public function getSetName()
353
    {
354
        return $this->setName;
355
    }
356
357
    /**
358
     * @param string $setName
359
     */
360
    public function setSetName($setName)
361
    {
362
        $this->setName = $setName;
363
    }
364
365
    /**
366
     * @return MaskPosition
367
     */
368
    public function getMaskPosition()
369
    {
370
        return $this->maskPosition;
371
    }
372
373
    /**
374
     * @param MaskPosition $maskPosition
375
     */
376
    public function setMaskPosition(MaskPosition $maskPosition)
377
    {
378
        $this->maskPosition = $maskPosition;
379
    }
380
381
    /**
382
     * @return string
383
     */
384
    public function getCustomEmojiId()
385
    {
386
        return $this->customEmojiId;
387
    }
388
389
    /**
390
     * @param string $customEmojiId
391
     */
392
    public function setCustomEmojiId($customEmojiId)
393
    {
394
        $this->customEmojiId = $customEmojiId;
395
    }
396
}
397