UpdateChatPhoto   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 47
rs 10
c 0
b 0
f 0
wmc 7

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getChatId() 0 3 1
A fromArray() 0 5 2
A typeSerialize() 0 6 2
A getPhoto() 0 3 1
A __construct() 0 6 1
1
<?php
2
3
/**
4
 * This phpFile is auto-generated.
5
 */
6
7
declare(strict_types=1);
8
9
namespace PHPTdGram\Schema;
10
11
/**
12
 * A chat photo was changed.
13
 */
14
class UpdateChatPhoto extends Update
15
{
16
    public const TYPE_NAME = 'updateChatPhoto';
17
18
    /**
19
     * Chat identifier.
20
     */
21
    protected int $chatId;
22
23
    /**
24
     * The new chat photo; may be null.
25
     */
26
    protected ?ChatPhoto $photo;
27
28
    public function __construct(int $chatId, ?ChatPhoto $photo)
29
    {
30
        parent::__construct();
31
32
        $this->chatId = $chatId;
33
        $this->photo  = $photo;
34
    }
35
36
    public static function fromArray(array $array): UpdateChatPhoto
37
    {
38
        return new static(
39
            $array['chat_id'],
40
            (isset($array['photo']) ? TdSchemaRegistry::fromArray($array['photo']) : null),
41
        );
42
    }
43
44
    public function typeSerialize(): array
45
    {
46
        return [
47
            '@type'   => static::TYPE_NAME,
48
            'chat_id' => $this->chatId,
49
            'photo'   => (isset($this->photo) ? $this->photo : null),
50
        ];
51
    }
52
53
    public function getChatId(): int
54
    {
55
        return $this->chatId;
56
    }
57
58
    public function getPhoto(): ?ChatPhoto
59
    {
60
        return $this->photo;
61
    }
62
}
63