Completed
Push — master ( a4a0d7...5dd6ba )
by Camilo
07:16
created

GetChat::getMandatoryFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 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\Chat;
12
13
/**
14
 * Use this method to get up to date information about the chat (current name of the user for one-on-one conversations,
15
 * current username of a user, group or channel, etc.). Returns a Chat object on success.
16
 *
17
 * Objects defined as-is july 2016
18
 *
19
 * @see https://core.telegram.org/bots/api#getchat
20
 */
21
class GetChat extends TelegramMethods
22
{
23
    /**
24
     * Unique identifier for the target chat or username of the target supergroup or channel (in the format
25
     * @channelusername)
26
     * @var string
27
     */
28
    public $chat_id = '';
29
30
    public static function bindToObject(TelegramRawData $data, LoggerInterface $logger): TelegramTypes
31
    {
32
        return new Chat($data->getResult(), $logger);
33
    }
34
35
    public function getMandatoryFields(): array
36
    {
37
        return [
38
            'chat_id',
39
        ];
40
    }
41
}
42