Completed
Push — master ( b03e4f...bb3ad1 )
by Camilo
02:00
created

UnpinChatMessage::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\ResultBoolean;
12
13
/**
14
 * Use this method to unpin a message in a supergroup chat. The bot must be an administrator in the chat for this to
15
 * work and must have the appropriate admin rights. Returns True on success
16
 *
17
 * Objects defined as-is july 2017
18
 *
19
 * @see https://core.telegram.org/bots/api#unpinchatmessage
20
 */
21
class UnpinChatMessage extends TelegramMethods
22
{
23
    /**
24
     * Unique identifier for the target chat or username of the target supergroup or channel (in the format
25
     * @var string
26
     */
27
    public $chat_id = '';
28
29
    public static function bindToObject(TelegramRawData $data, LoggerInterface $logger): TelegramTypes
30
    {
31
        return new ResultBoolean($data->getResultBoolean(), $logger);
32
    }
33
34
    public function getMandatoryFields(): array
35
    {
36
        return [
37
            'chat_id',
38
        ];
39
    }
40
}
41