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

PinChatMessage   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 34
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A bindToObject() 0 4 1
A getMandatoryFields() 0 7 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\TelegramRawData;
11
use unreal4u\TelegramAPI\Telegram\Types\Custom\ResultBoolean;
12
13
/**
14
 * Use this method to pin a message in a supergroup. The bot must be an administrator in the chat for this to work and
15
 * 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#pinchatmessage
20
 */
21
class PinChatMessage 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
    /**
30
     * Identifier of a message to pin
31
     * @var int
32
     */
33
    public $message_id = 0;
34
35
    /**
36
     * Optional. Pass True, if it is not necessary to send a notification to all group members about the new pinned
37
     * message
38
     * @var bool
39
     */
40
    public $disable_notification = false;
41
42
    public static function bindToObject(TelegramRawData $data, LoggerInterface $logger): TelegramTypes
43
    {
44
        return new ResultBoolean($data->getResultBoolean(), $logger);
45
    }
46
47
    public function getMandatoryFields(): array
48
    {
49
        return [
50
            'chat_id',
51
            'message_id',
52
        ];
53
    }
54
}
55