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

AddStickerToSet::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 add a new sticker to a set created by the bot. Returns True on success
17
 *
18
 * Objects defined as-is july 2017
19
 *
20
 * @see https://core.telegram.org/bots/api#addstickertoset
21
 */
22
class AddStickerToSet extends TelegramMethods
23
{
24
    /**
25
     * User identifier of created sticker set owner
26
     * @var int
27
     */
28
    public $user_id = 0;
29
30
    /**
31
     * Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only english
32
     * letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in
33
     * "_by_<bot username>". <bot_username> is case insensitive. 1-64 characters
34
     * @var string
35
     */
36
    public $name = '';
37
38
    /**
39
     * Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either
40
     * width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the
41
     * Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one
42
     * using multipart/form-data
43
     * @var InputFile
44
     */
45
    public $png_sticker;
46
47
    /**
48
     * One or more emoji corresponding to the sticker
49
     * @var string
50
     */
51
    public $emojis = '';
52
53
    /**
54
     * Position where the mask should be placed on faces
55
     * @var MaskPosition
56
     */
57
    public $mask_position;
58
59
    public static function bindToObject(TelegramRawData $data, LoggerInterface $logger): TelegramTypes
60
    {
61
        return new ResultBoolean($data->getResultBoolean(), $logger);
62
    }
63
64
    public function getMandatoryFields(): array
65
    {
66
        return [
67
            'user_id',
68
            'name',
69
            'png_sticker',
70
            'emojis',
71
        ];
72
    }
73
}
74