Completed
Push — master ( f47acd...27aef1 )
by Camilo
02:10
created

CreateNewStickerSet::bindToObject()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
crap 2
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace unreal4u\TelegramAPI\Telegram\Methods;
6
7
use Psr\Log\LoggerInterface;
8
use unreal4u\TelegramAPI\Abstracts\TelegramMethods;
9
use unreal4u\TelegramAPI\Abstracts\TelegramTypes;
10
use unreal4u\TelegramAPI\InternalFunctionality\TelegramRawData;
11
use unreal4u\TelegramAPI\Telegram\Types\Custom\InputFile;
12
use unreal4u\TelegramAPI\Telegram\Types\Custom\ResultBoolean;
13
use unreal4u\TelegramAPI\Telegram\Types\MaskPosition;
14
15
/**
16
 * Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set.
17
 * Returns True on success
18
 *
19
 * Objects defined as-is july 2017
20
 *
21
 * @see https://core.telegram.org/bots/api#createnewstickerset
22
 */
23
class CreateNewStickerSet extends TelegramMethods
24
{
25
    /**
26
     * User identifier of created sticker set owner
27
     * @var int
28
     */
29
    public $user_id = 0;
30
31
    /**
32
     * Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only english
33
     * letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in
34
     * "_by_<bot username>". <bot_username> is case insensitive. 1-64 characters
35
     * @var string
36
     */
37
    public $name = '';
38
39
    /**
40
     * Sticker set title, 1-64 characters
41
     * @var bool
42
     */
43
    public $title = '';
44
45
    /**
46
     * Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either
47
     * width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the
48
     * Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one
49
     * using multipart/form-data
50
     * @var InputFile
51
     */
52
    public $png_sticker;
53
54
    /**
55
     * One or more emoji corresponding to the sticker
56
     * @var string
57
     */
58
    public $emojis = '';
59
60
    /**
61
     * Pass True, if a set of mask stickers should be created
62
     * @var bool
63
     */
64
    public $is_masks = false;
65
66
    /**
67
     * Position where the mask should be placed on faces
68
     * @var MaskPosition
69
     */
70
    public $mask_position;
71
72
    public static function bindToObject(TelegramRawData $data, LoggerInterface $logger): TelegramTypes
73
    {
74
        return new ResultBoolean($data->getResultBoolean(), $logger);
75
    }
76
77
    public function getMandatoryFields(): array
78
    {
79
        return [
80
            'user_id',
81
            'name',
82
            'title',
83
            'png_sticker',
84
            'emojis',
85
        ];
86
    }
87
}
88