Completed
Push — master ( 588078...30ae0c )
by Nikolay
04:51 queued 02:15
created

CreateNewStickerSetMethod   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 81
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Greenplugin\TelegramBot\Method;
6
7
use Greenplugin\TelegramBot\Method\Traits\EmojisVariableTrait;
8
use Greenplugin\TelegramBot\Method\Traits\FillFromArrayTrait;
9
use Greenplugin\TelegramBot\Type\InputFileType;
10
use Greenplugin\TelegramBot\Type\MaskPositionType;
11
12
/**
13
 * Class CreateNewStickerSetMethod.
14
 *
15
 * @see https://core.telegram.org/bots/api#createnewstickerset
16
 */
17
class CreateNewStickerSetMethod
18
{
19
    use FillFromArrayTrait;
20
    use EmojisVariableTrait;
21
22
    /**
23
     * User identifier of created sticker set owner.
24
     *
25
     * @var int
26
     */
27
    public $userId;
28
29
    /**
30
     * Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals).
31
     * Can contain only english letters, digits and underscores.
32
     * Must begin with a letter, can't contain consecutive underscores and must end in “_by_<bot username>”.
33
     * <bot_username> is case insensitive. 1-64 characters.
34
     *
35
     * @var string
36
     */
37
    public $name;
38
39
    /**
40
     * Sticker set title, 1-64 characters.
41
     *
42
     * @var string
43
     */
44
    public $title;
45
46
    /**
47
     * Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px,
48
     * and either width or height must be exactly 512px.
49
     * Pass a file_id as a String to send a file that already exists on the Telegram servers,
50
     * pass an HTTP URL as a String for Telegram to get a file from the Internet,
51
     * or upload a new one using multipart/form-data.
52
     *
53
     * @var InputFileType|string
54
     */
55
    public $pngSticker;
56
57
    /**
58
     * Optional. Pass True, if a set of mask stickers should be created.
59
     *
60
     * @var bool|null
61
     */
62
    public $containsMasks;
63
64
    /**
65
     * Optional. A JSON-serialized object for position where the mask should be placed on faces.
66
     *
67
     * @var MaskPositionType|null
68
     */
69
    public $maskPosition;
70
71
    /**
72
     * CreateNewStickerSetMethod constructor.
73
     *
74
     * @param int                  $userId
75
     * @param string               $name
76
     * @param string               $title
77
     * @param InputFileType|string $pngSticker
78
     * @param string               $emojis
79
     * @param array|null           $data
80
     *
81
     * @throws \Greenplugin\TelegramBot\Exception\BadArgumentException
82
     */
83
    public function __construct(
84
        int $userId,
85
        string $name,
86
        string $title,
87
        $pngSticker,
88
        string $emojis,
89
        array $data = null
90
    ) {
91
        $this->userId = $userId;
92
        $this->$name = $name;
93
        $this->title = $title;
94
        $this->$pngSticker = $pngSticker;
95
        $this->emojis = $emojis;
96
        if ($data) {
97
            $this->fill($data);
98
        }
99
    }
100
}
101