|
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
|
|
|
* Describes a photo. |
|
13
|
|
|
*/ |
|
14
|
|
|
class Photo extends TdObject |
|
15
|
|
|
{ |
|
16
|
|
|
public const TYPE_NAME = 'photo'; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* True, if stickers were added to the photo. |
|
20
|
|
|
*/ |
|
21
|
|
|
protected bool $hasStickers; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Photo minithumbnail; may be null. |
|
25
|
|
|
*/ |
|
26
|
|
|
protected ?Minithumbnail $minithumbnail; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* Available variants of the photo, in different sizes. |
|
30
|
|
|
* |
|
31
|
|
|
* @var PhotoSize[] |
|
32
|
|
|
*/ |
|
33
|
|
|
protected array $sizes; |
|
34
|
|
|
|
|
35
|
|
|
public function __construct(bool $hasStickers, ?Minithumbnail $minithumbnail, array $sizes) |
|
36
|
|
|
{ |
|
37
|
|
|
$this->hasStickers = $hasStickers; |
|
38
|
|
|
$this->minithumbnail = $minithumbnail; |
|
39
|
|
|
$this->sizes = $sizes; |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
public static function fromArray(array $array): Photo |
|
43
|
|
|
{ |
|
44
|
|
|
return new static( |
|
45
|
|
|
$array['has_stickers'], |
|
46
|
|
|
(isset($array['minithumbnail']) ? TdSchemaRegistry::fromArray($array['minithumbnail']) : null), |
|
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
|
|
|
'has_stickers' => $this->hasStickers, |
|
56
|
|
|
'minithumbnail' => (isset($this->minithumbnail) ? $this->minithumbnail : null), |
|
57
|
|
|
array_map(fn ($x) => $x->typeSerialize(), $this->sizes), |
|
58
|
|
|
]; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function getHasStickers(): bool |
|
62
|
|
|
{ |
|
63
|
|
|
return $this->hasStickers; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
public function getMinithumbnail(): ?Minithumbnail |
|
67
|
|
|
{ |
|
68
|
|
|
return $this->minithumbnail; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
public function getSizes(): array |
|
72
|
|
|
{ |
|
73
|
|
|
return $this->sizes; |
|
74
|
|
|
} |
|
75
|
|
|
} |
|
76
|
|
|
|