UserProfilePhoto   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 20
dl 0
loc 60
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A typeSerialize() 0 7 1
A getAddedDate() 0 3 1
A getSizes() 0 3 1
A fromArray() 0 6 1
A __construct() 0 5 1
A getId() 0 3 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
 * Contains full information about a user profile photo.
13
 */
14
class UserProfilePhoto extends TdObject
15
{
16
    public const TYPE_NAME = 'userProfilePhoto';
17
18
    /**
19
     * Unique user profile photo identifier.
20
     */
21
    protected string $id;
22
23
    /**
24
     * Point in time (Unix timestamp) when the photo has been added.
25
     */
26
    protected int $addedDate;
27
28
    /**
29
     * Available variants of the user photo, in different sizes.
30
     *
31
     * @var PhotoSize[]
32
     */
33
    protected array $sizes;
34
35
    public function __construct(string $id, int $addedDate, array $sizes)
36
    {
37
        $this->id        = $id;
38
        $this->addedDate = $addedDate;
39
        $this->sizes     = $sizes;
40
    }
41
42
    public static function fromArray(array $array): UserProfilePhoto
43
    {
44
        return new static(
45
            $array['id'],
46
            $array['added_date'],
47
            array_map(fn ($x) => TdSchemaRegistry::fromArray($x), $array['sizes']),
48
        );
49
    }
50
51
    public function typeSerialize(): array
52
    {
53
        return [
54
            '@type'           => static::TYPE_NAME,
55
            'id'              => $this->id,
56
            'added_date'      => $this->addedDate,
57
            array_map(fn ($x) => $x->typeSerialize(), $this->sizes),
58
        ];
59
    }
60
61
    public function getId(): string
62
    {
63
        return $this->id;
64
    }
65
66
    public function getAddedDate(): int
67
    {
68
        return $this->addedDate;
69
    }
70
71
    public function getSizes(): array
72
    {
73
        return $this->sizes;
74
    }
75
}
76