UserProfilePhotos::getPhotos()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
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 part of the list of user photos.
13
 */
14
class UserProfilePhotos extends TdObject
15
{
16
    public const TYPE_NAME = 'userProfilePhotos';
17
18
    /**
19
     * Total number of user profile photos.
20
     */
21
    protected int $totalCount;
22
23
    /**
24
     * A list of photos.
25
     *
26
     * @var UserProfilePhoto[]
27
     */
28
    protected array $photos;
29
30
    public function __construct(int $totalCount, array $photos)
31
    {
32
        $this->totalCount = $totalCount;
33
        $this->photos     = $photos;
34
    }
35
36
    public static function fromArray(array $array): UserProfilePhotos
37
    {
38
        return new static(
39
            $array['total_count'],
40
            array_map(fn ($x) => TdSchemaRegistry::fromArray($x), $array['photos']),
41
        );
42
    }
43
44
    public function typeSerialize(): array
45
    {
46
        return [
47
            '@type'           => static::TYPE_NAME,
48
            'total_count'     => $this->totalCount,
49
            array_map(fn ($x) => $x->typeSerialize(), $this->photos),
50
        ];
51
    }
52
53
    public function getTotalCount(): int
54
    {
55
        return $this->totalCount;
56
    }
57
58
    public function getPhotos(): array
59
    {
60
        return $this->photos;
61
    }
62
}
63