Completed
Push — master ( a60507...6275b0 )
by Camilo
12:13 queued 02:14
created

UnpinAllChatMessages   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A bindToObject() 0 4 1
A getMandatoryFields() 0 6 1
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\TelegramResponse;
11
use unreal4u\TelegramAPI\Telegram\Types\Custom\ResultBoolean;
12
13
/**
14
 * Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an
15
 * administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or
16
 * 'can_edit_messages' admin right in a channel. Returns True on success.
17
 *
18
 * Objects defined as-is november 2020, Bot API v5.0
19
 *
20
 * @see https://core.telegram.org/bots/api#unpinchatmessage
21
 */
22
class UnpinAllChatMessages extends TelegramMethods
23
{
24
    /**
25
     * Unique identifier for the target chat or username of the target supergroup or channel (in the format
26
     * @var string
27
     */
28
    public $chat_id = '';
29
30
    public static function bindToObject(TelegramResponse $data, LoggerInterface $logger): TelegramTypes
31
    {
32
        return new ResultBoolean($data->getResultBoolean(), $logger);
33
    }
34
35
    public function getMandatoryFields(): array
36
    {
37
        return [
38
            'chat_id',
39
        ];
40
    }
41
}
42