Passed
Push — master ( 1b1236...bd5fab )
by Nikolay
01:00 queued 15s
created

SetStickerSetThumbMethod   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
eloc 9
c 1
b 0
f 1
dl 0
loc 41
ccs 6
cts 6
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Method;
6
7
use TgBotApi\BotApiBase\Method\Interfaces\SetMethodAliasInterface;
8
use TgBotApi\BotApiBase\Type\InputFileType;
9
10
/**
11
 * Class SetStickerSetThumbMethod.
12
 *
13
 * Use this method to set the thumbnail of a sticker set.
14
 * Animated thumbnails can be set for animated sticker sets only.
15
 * Returns True on success.
16
 *
17
 * @see https://core.telegram.org/bots/api#setstickersetthumb
18
 */
19
class SetStickerSetThumbMethod implements SetMethodAliasInterface
20
{
21
    /**
22
     * Sticker set name.
23
     *
24
     * @var string
25
     */
26
    public $name;
27
28
    /**
29
     * User identifier of the sticker set owner.
30
     *
31
     * @var int
32
     */
33
    public $userId;
34
35
    /**
36
     * Optional. A PNG image with the thumbnail, must be up to 128 kilobytes in size
37
     * and have width and height exactly 100px, or a TGS animation with the thumbnail up to 32 kilobytes in size;
38
     * see https://core.telegram.org/animated_stickers#technical-requirements for animated sticker technical
39
     * requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers,
40
     * pass an HTTP URL as a String for Telegram to get a file from the Internet,
41
     * or upload a new one using multipart/form-data.
42
     * More info on Sending Files: https://core.telegram.org/bots/api#sending-files.
43
     * Animated sticker set thumbnail can't be uploaded via HTTP URL.
44
     *
45
     * @var InputFileType|string|null
46
     */
47
    public $thumb;
48
49
    /**
50
     * @param InputFileType|string|null $thumb
51
     */
52 1
    public static function create(string $name, int $userId, $thumb = null): SetStickerSetThumbMethod
53
    {
54 1
        $instance = new static();
55 1
        $instance->name = $name;
56 1
        $instance->userId = $userId;
57 1
        $instance->thumb = $thumb;
58
59 1
        return $instance;
60
    }
61
}
62