GetMapThumbnailFile   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 109
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 35
dl 0
loc 109
rs 10
c 0
b 0
f 0
wmc 9

9 Methods

Rating   Name   Duplication   Size   Complexity  
A getHeight() 0 3 1
A getScale() 0 3 1
A getWidth() 0 3 1
A getLocation() 0 3 1
A __construct() 0 8 1
A getChatId() 0 3 1
A fromArray() 0 9 1
A getZoom() 0 3 1
A typeSerialize() 0 10 1
1
<?php
2
3
/**
4
 * This phpFile is auto-generated.
5
 */
6
7
declare(strict_types=1);
8
9
namespace AurimasNiekis\TdLibSchema;
10
11
/**
12
 * Returns information about a file with a map thumbnail in PNG format. Only map thumbnail files with size less than 1MB can be downloaded.
13
 */
14
class GetMapThumbnailFile extends TdFunction
15
{
16
    public const TYPE_NAME = 'getMapThumbnailFile';
17
18
    /**
19
     * Location of the map center.
20
     *
21
     * @var Location
22
     */
23
    protected Location $location;
24
25
    /**
26
     * Map zoom level; 13-20.
27
     *
28
     * @var int
29
     */
30
    protected int $zoom;
31
32
    /**
33
     * Map width in pixels before applying scale; 16-1024.
34
     *
35
     * @var int
36
     */
37
    protected int $width;
38
39
    /**
40
     * Map height in pixels before applying scale; 16-1024.
41
     *
42
     * @var int
43
     */
44
    protected int $height;
45
46
    /**
47
     * Map scale; 1-3.
48
     *
49
     * @var int
50
     */
51
    protected int $scale;
52
53
    /**
54
     * Identifier of a chat, in which the thumbnail will be shown. Use 0 if unknown.
55
     *
56
     * @var int
57
     */
58
    protected int $chatId;
59
60
    public function __construct(Location $location, int $zoom, int $width, int $height, int $scale, int $chatId)
61
    {
62
        $this->location = $location;
63
        $this->zoom     = $zoom;
64
        $this->width    = $width;
65
        $this->height   = $height;
66
        $this->scale    = $scale;
67
        $this->chatId   = $chatId;
68
    }
69
70
    public static function fromArray(array $array): GetMapThumbnailFile
71
    {
72
        return new static(
73
            TdSchemaRegistry::fromArray($array['location']),
74
            $array['zoom'],
75
            $array['width'],
76
            $array['height'],
77
            $array['scale'],
78
            $array['chat_id'],
79
        );
80
    }
81
82
    public function typeSerialize(): array
83
    {
84
        return [
85
            '@type'    => static::TYPE_NAME,
86
            'location' => $this->location->typeSerialize(),
87
            'zoom'     => $this->zoom,
88
            'width'    => $this->width,
89
            'height'   => $this->height,
90
            'scale'    => $this->scale,
91
            'chat_id'  => $this->chatId,
92
        ];
93
    }
94
95
    public function getLocation(): Location
96
    {
97
        return $this->location;
98
    }
99
100
    public function getZoom(): int
101
    {
102
        return $this->zoom;
103
    }
104
105
    public function getWidth(): int
106
    {
107
        return $this->width;
108
    }
109
110
    public function getHeight(): int
111
    {
112
        return $this->height;
113
    }
114
115
    public function getScale(): int
116
    {
117
        return $this->scale;
118
    }
119
120
    public function getChatId(): int
121
    {
122
        return $this->chatId;
123
    }
124
}
125