From 0b47ee8fd0b32aa443008d697a04ce312920b7ff Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Sun, 9 Jun 2024 11:23:31 +0200 Subject: [PATCH] Add DrawableInterface::setPosition() --- src/Geometry/Bezier.php | 12 ++++++++++++ src/Geometry/Ellipse.php | 5 ++--- src/Geometry/Polygon.php | 5 ++--- src/Interfaces/DrawableInterface.php | 8 ++++++++ 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/Geometry/Bezier.php b/src/Geometry/Bezier.php index 66ba9b9f..1dabfde0 100644 --- a/src/Geometry/Bezier.php +++ b/src/Geometry/Bezier.php @@ -46,6 +46,18 @@ class Bezier implements IteratorAggregate, Countable, ArrayAccess, DrawableInter return $this->pivot; } + /** + * {@inheritdoc} + * + * @see DrawableInterface::setPosition() + */ + public function setPosition(PointInterface $position): DrawableInterface + { + $this->pivot = $position; + + return $this; + } + /** * Implement iteration through all points of bezier * diff --git a/src/Geometry/Ellipse.php b/src/Geometry/Ellipse.php index cb7471ea..3209629b 100644 --- a/src/Geometry/Ellipse.php +++ b/src/Geometry/Ellipse.php @@ -40,10 +40,9 @@ class Ellipse implements DrawableInterface } /** - * Set position if ellipse + * {@inheritdoc} * - * @param PointInterface $position - * @return Ellipse + * @see DrawableInterface::setPosition() */ public function setPosition(PointInterface $position): self { diff --git a/src/Geometry/Polygon.php b/src/Geometry/Polygon.php index f37a41b0..4ec1ab88 100644 --- a/src/Geometry/Polygon.php +++ b/src/Geometry/Polygon.php @@ -47,10 +47,9 @@ class Polygon implements IteratorAggregate, Countable, ArrayAccess, DrawableInte } /** - * Set pivot position of polygon + * {@inheritdoc} * - * @param PointInterface $position - * @return Polygon + * @see DrawableInterface::setPosition() */ public function setPosition(PointInterface $position): self { diff --git a/src/Interfaces/DrawableInterface.php b/src/Interfaces/DrawableInterface.php index bb0763df..691f6791 100644 --- a/src/Interfaces/DrawableInterface.php +++ b/src/Interfaces/DrawableInterface.php @@ -13,6 +13,14 @@ interface DrawableInterface */ public function position(): PointInterface; + /** + * Set position of the drawable object + * + * @param PointInterface $position + * @return DrawableInterface + */ + public function setPosition(PointInterface $position): self; + /** * Set the background color of the drawable object *