| Total Complexity | 7 |
| Total Lines | 73 |
| 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 | protected InputFile $sticker; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Sticker thumbnail, if available. |
||
| 25 | */ |
||
| 26 | protected InputThumbnail $thumbnail; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Sticker width. |
||
| 30 | */ |
||
| 31 | protected int $width; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Sticker height. |
||
| 35 | */ |
||
| 36 | protected int $height; |
||
| 37 | |||
| 38 | public function __construct(InputFile $sticker, InputThumbnail $thumbnail, int $width, int $height) |
||
| 39 | { |
||
| 40 | parent::__construct(); |
||
| 41 | |||
| 42 | $this->sticker = $sticker; |
||
| 43 | $this->thumbnail = $thumbnail; |
||
| 44 | $this->width = $width; |
||
| 45 | $this->height = $height; |
||
| 46 | } |
||
| 47 | |||
| 48 | public static function fromArray(array $array): InputMessageSticker |
||
| 49 | { |
||
| 50 | return new static( |
||
| 51 | TdSchemaRegistry::fromArray($array['sticker']), |
||
| 52 | TdSchemaRegistry::fromArray($array['thumbnail']), |
||
| 53 | $array['width'], |
||
| 54 | $array['height'], |
||
| 55 | ); |
||
| 56 | } |
||
| 57 | |||
| 58 | public function typeSerialize(): array |
||
| 59 | { |
||
| 60 | return [ |
||
| 61 | '@type' => static::TYPE_NAME, |
||
| 62 | 'sticker' => $this->sticker->typeSerialize(), |
||
| 63 | 'thumbnail' => $this->thumbnail->typeSerialize(), |
||
| 64 | 'width' => $this->width, |
||
| 65 | 'height' => $this->height, |
||
| 66 | ]; |
||
| 67 | } |
||
| 68 | |||
| 69 | public function getSticker(): InputFile |
||
| 72 | } |
||
| 73 | |||
| 74 | public function getThumbnail(): InputThumbnail |
||
| 75 | { |
||
| 76 | return $this->thumbnail; |
||
| 77 | } |
||
| 78 | |||
| 79 | public function getWidth(): int |
||
| 82 | } |
||
| 83 | |||
| 84 | public function getHeight(): int |
||
| 87 | } |
||
| 88 | } |
||
| 89 |