Completed
Push — master ( 24b2c2...c2a3d2 )
by Camilo
11s
created

SetPassportDataErrors   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 27
ccs 0
cts 4
cp 0
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 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\TelegramResponse;
11
use unreal4u\TelegramAPI\Telegram\Types\Custom\ResultBoolean;
12
use unreal4u\TelegramAPI\Telegram\Types\Passport\PassportElementError;
13
14
/**
15
 * Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an
16
 * administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success
17
 *
18
 * Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Admins’ setting is
19
 * off in the target group
20
 *
21
 * Objects defined as-is july 2017
22
 *
23
 * @see https://core.telegram.org/bots/api#setchattitle
24
 */
25
class SetPassportDataErrors extends TelegramMethods
26
{
27
    /**
28
     * User identifier
29
     * @var string
30
     */
31
    public $user_id = 0;
32
33
    /**
34
     * A JSON-serialized array describing the errors
35
     * @var PassportElementError[]
36
     */
37
    public $errors = [];
38
39
    public static function bindToObject(TelegramResponse $data, LoggerInterface $logger): TelegramTypes
40
    {
41
        return new ResultBoolean($data->getResultBoolean(), $logger);
42
    }
43
44
    public function getMandatoryFields(): array
45
    {
46
        return [
47
            'user_id',
48
            'errors',
49
        ];
50
    }
51
}
52