Completed
Push — master ( 4ede18...f88253 )
by Camilo
06:20
created

SetChatStickerSet::bindToObject()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
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\ResultBoolean;
12
13
/**
14
 * Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for
15
 * this to work and must have the appropriate admin rights. Use the field can_set_sticker_set optionally returned in
16
 * getChat requests to check if the bot can use this method. Returns True on success
17
 *
18
 * Objects defined as-is october 2017
19
 *
20
 * @see https://core.telegram.org/bots/api#setchatstickerset
21
 */
22
class SetChatStickerSet extends TelegramMethods
23
{
24
    /**
25
     * Unique identifier for the target chat or username of the target supergroup or channel (in the format
26
     * @channelusername)
27
     * @var string
28
     */
29
    public $chat_id = '';
30
31
    /**
32
     * Name of the sticker set to be set as the group sticker set
33
     * @var string
34
     */
35
    public $sticker_set_name = '';
36
37
    public static function bindToObject(TelegramRawData $data, LoggerInterface $logger): TelegramTypes
38
    {
39
        return new ResultBoolean($data->getResultBoolean(), $logger);
40
    }
41
42
    public function getMandatoryFields(): array
43
    {
44
        return [
45
            'chat_id',
46
            'sticker_set_name',
47
        ];
48
    }
49
}
50