diff --git a/src/Geometry/Factories/BezierFactory.php b/src/Geometry/Factories/BezierFactory.php index 8747bd50..07450a45 100644 --- a/src/Geometry/Factories/BezierFactory.php +++ b/src/Geometry/Factories/BezierFactory.php @@ -28,6 +28,16 @@ class BezierFactory implements DrawableFactoryInterface } } + /** + * {@inheritdoc} + * + * @see DrawableFactoryInterface::init() + */ + public static function init(null|callable|DrawableInterface $init = null): self + { + return new self($init); + } + /** * {@inheritdoc} * diff --git a/src/Geometry/Factories/CircleFactory.php b/src/Geometry/Factories/CircleFactory.php index ed4cad10..9f52b37f 100644 --- a/src/Geometry/Factories/CircleFactory.php +++ b/src/Geometry/Factories/CircleFactory.php @@ -33,6 +33,16 @@ class CircleFactory implements DrawableFactoryInterface } } + /** + * {@inheritdoc} + * + * @see DrawableFactoryInterface::init() + */ + public static function init(null|callable|DrawableInterface $init = null): self + { + return new self(init: $init); + } + /** * {@inheritdoc} * diff --git a/src/Geometry/Factories/EllipseFactory.php b/src/Geometry/Factories/EllipseFactory.php index 8bb9298f..6337181c 100644 --- a/src/Geometry/Factories/EllipseFactory.php +++ b/src/Geometry/Factories/EllipseFactory.php @@ -33,6 +33,16 @@ class EllipseFactory implements DrawableFactoryInterface } } + /** + * {@inheritdoc} + * + * @see DrawableFactoryInterface::init() + */ + public static function init(null|callable|DrawableInterface $init = null): self + { + return new self(init: $init); + } + /** * {@inheritdoc} * diff --git a/src/Geometry/Factories/LineFactory.php b/src/Geometry/Factories/LineFactory.php index 7876584b..c2752096 100644 --- a/src/Geometry/Factories/LineFactory.php +++ b/src/Geometry/Factories/LineFactory.php @@ -28,6 +28,16 @@ class LineFactory implements DrawableFactoryInterface } } + /** + * {@inheritdoc} + * + * @see DrawableFactoryInterface::init() + */ + public static function init(null|callable|DrawableInterface $init = null): self + { + return new self($init); + } + /** * {@inheritdoc} * diff --git a/src/Geometry/Factories/PolygonFactory.php b/src/Geometry/Factories/PolygonFactory.php index ef18b800..6ee80c4c 100644 --- a/src/Geometry/Factories/PolygonFactory.php +++ b/src/Geometry/Factories/PolygonFactory.php @@ -28,6 +28,16 @@ class PolygonFactory implements DrawableFactoryInterface } } + /** + * {@inheritdoc} + * + * @see DrawableFactoryInterface::init() + */ + public static function init(null|callable|DrawableInterface $init = null): self + { + return new self($init); + } + /** * {@inheritdoc} * diff --git a/src/Geometry/Factories/RectangleFactory.php b/src/Geometry/Factories/RectangleFactory.php index d6402a29..e8c3664a 100644 --- a/src/Geometry/Factories/RectangleFactory.php +++ b/src/Geometry/Factories/RectangleFactory.php @@ -33,6 +33,16 @@ class RectangleFactory implements DrawableFactoryInterface } } + /** + * {@inheritdoc} + * + * @see DrawableFactoryInterface::init() + */ + public static function init(null|callable|DrawableInterface $init = null): self + { + return new self(init: $init); + } + /** * {@inheritdoc} * diff --git a/src/Interfaces/DrawableFactoryInterface.php b/src/Interfaces/DrawableFactoryInterface.php index a5284f39..f4de9d6b 100644 --- a/src/Interfaces/DrawableFactoryInterface.php +++ b/src/Interfaces/DrawableFactoryInterface.php @@ -6,6 +6,14 @@ namespace Intervention\Image\Interfaces; interface DrawableFactoryInterface { + /** + * Create a new factory instance statically + * + * @param null|callable|DrawableInterface $init + * @return DrawableFactoryInterface + */ + public static function init(null|callable|DrawableInterface $init = null): self; + /** * Create the end product of the factory *