diff --git a/src/TgBotLib/Objects/MaskPosition.php b/src/TgBotLib/Objects/MaskPosition.php new file mode 100644 index 0000000..260a50c --- /dev/null +++ b/src/TgBotLib/Objects/MaskPosition.php @@ -0,0 +1,106 @@ +point; + } + + /** + * Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, + * choosing -1.0 will place mask just to the left of the default mask position. + * + * @return float|int + */ + public function getXShift(): float|int + { + return $this->x_shift; + } + + /** + * Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, + * 1.0 will place the mask just below the default mask position. + * + * @return float|int + */ + public function getYShift(): float|int + { + return $this->y_shift; + } + + /** + * Mask scaling coefficient. For example, 2.0 means double size. + * + * @return float|int + */ + public function getScale(): float|int + { + return $this->scale; + } + + /** + * Returns an array representation of the object + * + * @return array + */ + public function toArray(): array + { + return [ + 'point' => $this->point, + 'x_shift' => $this->x_shift, + 'y_shift' => $this->y_shift, + 'scale' => $this->scale, + ]; + } + + /** + * Constructs object from an array representation + * + * @param array $data + * @return ObjectTypeInterface + */ + public static function fromArray(array $data): ObjectTypeInterface + { + $object = new self(); + + $object->point = $data['point']; + $object->x_shift = $data['x_shift']; + $object->y_shift = $data['y_shift']; + $object->scale = $data['scale']; + + return $object; + } + } \ No newline at end of file