InputMessageSticker   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 81
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 26
dl 0
loc 81
rs 10
c 0
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getWidth() 0 3 1
A fromArray() 0 7 1
A getSticker() 0 3 1
A typeSerialize() 0 8 1
A getHeight() 0 3 1
A getThumbnail() 0 3 1
A __construct() 0 8 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
 * A sticker message.
13
 */
14
class InputMessageSticker extends InputMessageContent
15
{
16
    public const TYPE_NAME = 'inputMessageSticker';
17
18
    /**
19
     * Sticker to be sent.
20
     *
21
     * @var InputFile
22
     */
23
    protected InputFile $sticker;
24
25
    /**
26
     * Sticker thumbnail, if available.
27
     *
28
     * @var InputThumbnail
29
     */
30
    protected InputThumbnail $thumbnail;
31
32
    /**
33
     * Sticker width.
34
     *
35
     * @var int
36
     */
37
    protected int $width;
38
39
    /**
40
     * Sticker height.
41
     *
42
     * @var int
43
     */
44
    protected int $height;
45
46
    public function __construct(InputFile $sticker, InputThumbnail $thumbnail, int $width, int $height)
47
    {
48
        parent::__construct();
49
50
        $this->sticker   = $sticker;
51
        $this->thumbnail = $thumbnail;
52
        $this->width     = $width;
53
        $this->height    = $height;
54
    }
55
56
    public static function fromArray(array $array): InputMessageSticker
57
    {
58
        return new static(
59
            TdSchemaRegistry::fromArray($array['sticker']),
60
            TdSchemaRegistry::fromArray($array['thumbnail']),
61
            $array['width'],
62
            $array['height'],
63
        );
64
    }
65
66
    public function typeSerialize(): array
67
    {
68
        return [
69
            '@type'     => static::TYPE_NAME,
70
            'sticker'   => $this->sticker->typeSerialize(),
71
            'thumbnail' => $this->thumbnail->typeSerialize(),
72
            'width'     => $this->width,
73
            'height'    => $this->height,
74
        ];
75
    }
76
77
    public function getSticker(): InputFile
78
    {
79
        return $this->sticker;
80
    }
81
82
    public function getThumbnail(): InputThumbnail
83
    {
84
        return $this->thumbnail;
85
    }
86
87
    public function getWidth(): int
88
    {
89
        return $this->width;
90
    }
91
92
    public function getHeight(): int
93
    {
94
        return $this->height;
95
    }
96
}
97