| Total Complexity | 7 |
| Total Lines | 81 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 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 |
||
| 90 | } |
||
| 91 | |||
| 92 | public function getHeight(): int |
||
| 93 | { |
||
| 95 | } |
||
| 96 | } |
||
| 97 |