diff --git a/lib/LongitudeOne/SpatialTypes/Types/AbstractCollection.php b/lib/LongitudeOne/SpatialTypes/Types/AbstractCollection.php index 543062c..d1476d3 100644 --- a/lib/LongitudeOne/SpatialTypes/Types/AbstractCollection.php +++ b/lib/LongitudeOne/SpatialTypes/Types/AbstractCollection.php @@ -39,7 +39,6 @@ abstract class AbstractCollection extends AbstractSpatialType implements Collect */ public function __construct(?int $srid = null) { - $this->preConstruct(); $this->setSrid($srid); } diff --git a/lib/LongitudeOne/SpatialTypes/Types/AbstractLineString.php b/lib/LongitudeOne/SpatialTypes/Types/AbstractLineString.php index 604c107..75cf68c 100644 --- a/lib/LongitudeOne/SpatialTypes/Types/AbstractLineString.php +++ b/lib/LongitudeOne/SpatialTypes/Types/AbstractLineString.php @@ -41,7 +41,6 @@ abstract class AbstractLineString extends AbstractSpatialType implements LineStr */ public function __construct(array $points, ?int $srid = null) { - $this->preConstruct(); $this->setSrid($srid); $this->addPoints($points); diff --git a/lib/LongitudeOne/SpatialTypes/Types/AbstractMultiLineString.php b/lib/LongitudeOne/SpatialTypes/Types/AbstractMultiLineString.php index 9ce7876..9f644c6 100644 --- a/lib/LongitudeOne/SpatialTypes/Types/AbstractMultiLineString.php +++ b/lib/LongitudeOne/SpatialTypes/Types/AbstractMultiLineString.php @@ -45,7 +45,6 @@ abstract class AbstractMultiLineString extends AbstractSpatialType implements Mu */ public function __construct(array $lineStrings, ?int $srid = null) { - $this->preConstruct(); $this->setSrid($srid); $this->addLineStrings($lineStrings); } diff --git a/lib/LongitudeOne/SpatialTypes/Types/AbstractMultiPoint.php b/lib/LongitudeOne/SpatialTypes/Types/AbstractMultiPoint.php index 1b2e061..918c9a8 100644 --- a/lib/LongitudeOne/SpatialTypes/Types/AbstractMultiPoint.php +++ b/lib/LongitudeOne/SpatialTypes/Types/AbstractMultiPoint.php @@ -41,7 +41,6 @@ abstract class AbstractMultiPoint extends AbstractSpatialType implements MultiPo */ public function __construct(array $points, ?int $srid = null) { - $this->preConstruct(); $this->setSrid($srid); $this->addPoints($points); diff --git a/lib/LongitudeOne/SpatialTypes/Types/AbstractMultiPolygon.php b/lib/LongitudeOne/SpatialTypes/Types/AbstractMultiPolygon.php index 0d4c107..5022729 100644 --- a/lib/LongitudeOne/SpatialTypes/Types/AbstractMultiPolygon.php +++ b/lib/LongitudeOne/SpatialTypes/Types/AbstractMultiPolygon.php @@ -52,7 +52,6 @@ abstract class AbstractMultiPolygon extends AbstractSpatialType implements Multi */ public function __construct(array $polygons, ?int $srid = null) { - $this->preConstruct(); $this->setSrid($srid); $this->addPolygons($polygons); } diff --git a/lib/LongitudeOne/SpatialTypes/Types/AbstractPolygon.php b/lib/LongitudeOne/SpatialTypes/Types/AbstractPolygon.php index db38133..c820d2d 100644 --- a/lib/LongitudeOne/SpatialTypes/Types/AbstractPolygon.php +++ b/lib/LongitudeOne/SpatialTypes/Types/AbstractPolygon.php @@ -46,7 +46,6 @@ abstract class AbstractPolygon extends AbstractSpatialType implements PolygonInt */ public function __construct(array $rings, ?int $srid = null) { - $this->preConstruct(); $this->setSrid($srid); $this->addRings($rings); } diff --git a/lib/LongitudeOne/SpatialTypes/Types/AbstractSpatialType.php b/lib/LongitudeOne/SpatialTypes/Types/AbstractSpatialType.php index 7ec1a99..cb65ebd 100644 --- a/lib/LongitudeOne/SpatialTypes/Types/AbstractSpatialType.php +++ b/lib/LongitudeOne/SpatialTypes/Types/AbstractSpatialType.php @@ -18,8 +18,6 @@ use LongitudeOne\SpatialTypes\Enum\DimensionEnum; use LongitudeOne\SpatialTypes\Enum\FamilyEnum; -use LongitudeOne\SpatialTypes\Enum\TypeEnum; -use LongitudeOne\SpatialTypes\Helper\DimensionHelper; use LongitudeOne\SpatialTypes\Interfaces\SpatialInterface; /** @@ -29,36 +27,11 @@ */ abstract class AbstractSpatialType implements SpatialInterface { - /** - * @var DimensionEnum the dimension of the object (2D, 3D with elevation, 3D with moment, 4D) - */ - protected DimensionEnum $dimension; - - /** - * @var FamilyEnum the family of the object (Geometry, Geography) - */ - protected FamilyEnum $family; - /** * @var null|int the SpatialTypes Reference Identifier (SRID) */ protected ?int $srid = null; - /** - * @var TypeEnum The type of the object (Point, LineString, Polygon, etc.). - */ - protected TypeEnum $type; - - /** - * Family getter. - * - * @return FamilyEnum the family of the object (Geometry, Geography) - */ - public function getFamily(): FamilyEnum - { - return $this->family; - } - /** * SRID getter. */ @@ -67,22 +40,15 @@ public function getSrid(): ?int return $this->srid; } - /** - * Type getter. - */ - public function getType(): string - { - return $this->type->value; - } - /** * Does this object (or point of this object) have an M coordinate? */ public function hasM(): bool { - $dimensionHelper = new DimensionHelper($this->dimension); - - return $dimensionHelper->hasM(); + return match ($this->getDimension()) { + DimensionEnum::X_Y_M, DimensionEnum::X_Y_Z_M => true, + default => false, + }; } /** @@ -100,9 +66,10 @@ public function hasSameDimension(SpatialInterface $spatial): bool */ public function hasZ(): bool { - $dimensionHelper = new DimensionHelper($this->dimension); - - return $dimensionHelper->hasZ(); + return match ($this->getDimension()) { + DimensionEnum::X_Y_Z, DimensionEnum::X_Y_Z_M => true, + default => false, + }; } /** @@ -134,41 +101,19 @@ public function setSrid(?int $srid): static /** * Dimension getter. */ - protected function getDimension(): DimensionEnum - { - return $this->dimension; - } + abstract protected function getDimension(): DimensionEnum; /** - * Pre-construct method. - */ - protected function preConstruct(): void - { - $this->type = $this->initType(); - $this->family = $this->initFamily(); - $this->dimension = $this->initDimension(); - } - - /** - * This function is called in the main constructor. - * - * @return DimensionEnum the dimension of the object (2D, 3D with elevation, 3D with moment, 4D) - */ - abstract protected function initDimension(): DimensionEnum; - - /** - * This function is called in the main constructor. + * Family getter. * * @return FamilyEnum the family of the object (Geometry, Geography) */ - abstract protected function initFamily(): FamilyEnum; + abstract public function getFamily(): FamilyEnum; /** - * This function is called in the main constructor. - * - * @return TypeEnum The type of the object (Point, LineString, Polygon, etc.). + * Type getter. */ - abstract protected function initType(): TypeEnum; + abstract public function getType(): string; /** * Convert any spatial object to its array representation. diff --git a/lib/LongitudeOne/SpatialTypes/Types/Geography/GeographyCollection.php b/lib/LongitudeOne/SpatialTypes/Types/Geography/GeographyCollection.php index 6679274..fdb9ae6 100644 --- a/lib/LongitudeOne/SpatialTypes/Types/Geography/GeographyCollection.php +++ b/lib/LongitudeOne/SpatialTypes/Types/Geography/GeographyCollection.php @@ -25,26 +25,26 @@ class GeographyCollection extends AbstractCollection implements CollectionInterface { /** - * initDimension. + * init Family. */ - protected function initDimension(): DimensionEnum + public function getFamily(): FamilyEnum { - return DimensionEnum::X_Y; + return FamilyEnum::GEOGRAPHY; } /** - * init Family. + * initType. */ - protected function initFamily(): FamilyEnum + public function getType(): string { - return FamilyEnum::GEOGRAPHY; + return TypeEnum::COLLECTION->value; } /** - * initType. + * initDimension. */ - protected function initType(): TypeEnum + protected function getDimension(): DimensionEnum { - return TypeEnum::COLLECTION; + return DimensionEnum::X_Y; } } diff --git a/lib/LongitudeOne/SpatialTypes/Types/Geography/LineString.php b/lib/LongitudeOne/SpatialTypes/Types/Geography/LineString.php index 1e94a7f..0997ee8 100644 --- a/lib/LongitudeOne/SpatialTypes/Types/Geography/LineString.php +++ b/lib/LongitudeOne/SpatialTypes/Types/Geography/LineString.php @@ -25,26 +25,26 @@ class LineString extends AbstractLineString implements LineStringInterface { /** - * Define the dimension. + * Define the family. */ - protected function initDimension(): DimensionEnum + public function getFamily(): FamilyEnum { - return DimensionEnum::X_Y; + return FamilyEnum::GEOGRAPHY; } /** - * Define the family. + * Define the type. */ - protected function initFamily(): FamilyEnum + public function getType(): string { - return FamilyEnum::GEOGRAPHY; + return TypeEnum::LINESTRING->value; } /** - * Define the type. + * Define the dimension. */ - protected function initType(): TypeEnum + protected function getDimension(): DimensionEnum { - return TypeEnum::LINESTRING; + return DimensionEnum::X_Y; } } diff --git a/lib/LongitudeOne/SpatialTypes/Types/Geography/MultiLineString.php b/lib/LongitudeOne/SpatialTypes/Types/Geography/MultiLineString.php index 272cd5f..0b178f2 100644 --- a/lib/LongitudeOne/SpatialTypes/Types/Geography/MultiLineString.php +++ b/lib/LongitudeOne/SpatialTypes/Types/Geography/MultiLineString.php @@ -25,26 +25,26 @@ class MultiLineString extends AbstractMultiLineString implements MultiLineStringInterface { /** - * Initialize the dimension of the object. + * Initialize the family of the object. */ - protected function initDimension(): DimensionEnum + public function getFamily(): FamilyEnum { - return DimensionEnum::X_Y; + return FamilyEnum::GEOGRAPHY; } /** - * Initialize the family of the object. + * Initialize the type of the object. */ - protected function initFamily(): FamilyEnum + public function getType(): string { - return FamilyEnum::GEOGRAPHY; + return TypeEnum::MULTILINESTRING->value; } /** - * Initialize the type of the object. + * Initialize the dimension of the object. */ - protected function initType(): TypeEnum + protected function getDimension(): DimensionEnum { - return TypeEnum::MULTILINESTRING; + return DimensionEnum::X_Y; } } diff --git a/lib/LongitudeOne/SpatialTypes/Types/Geography/MultiPoint.php b/lib/LongitudeOne/SpatialTypes/Types/Geography/MultiPoint.php index b7c331c..8de6103 100644 --- a/lib/LongitudeOne/SpatialTypes/Types/Geography/MultiPoint.php +++ b/lib/LongitudeOne/SpatialTypes/Types/Geography/MultiPoint.php @@ -25,26 +25,26 @@ class MultiPoint extends AbstractMultiPoint implements MultiPointInterface { /** - * Define the dimension. + * Define the family. */ - protected function initDimension(): DimensionEnum + public function getFamily(): FamilyEnum { - return DimensionEnum::X_Y; + return FamilyEnum::GEOGRAPHY; } /** - * Define the family. + * Define the type. */ - protected function initFamily(): FamilyEnum + public function getType(): string { - return FamilyEnum::GEOGRAPHY; + return TypeEnum::MULTIPOINT->value; } /** - * Define the type. + * Define the dimension. */ - protected function initType(): TypeEnum + protected function getDimension(): DimensionEnum { - return TypeEnum::MULTIPOINT; + return DimensionEnum::X_Y; } } diff --git a/lib/LongitudeOne/SpatialTypes/Types/Geography/MultiPolygon.php b/lib/LongitudeOne/SpatialTypes/Types/Geography/MultiPolygon.php index df26bd2..b82f33d 100644 --- a/lib/LongitudeOne/SpatialTypes/Types/Geography/MultiPolygon.php +++ b/lib/LongitudeOne/SpatialTypes/Types/Geography/MultiPolygon.php @@ -25,26 +25,26 @@ class MultiPolygon extends AbstractMultiPolygon implements MultiPolygonInterface { /** - * Initialize the dimension of the object. + * Initialize the family of the object. */ - protected function initDimension(): DimensionEnum + public function getFamily(): FamilyEnum { - return DimensionEnum::X_Y; + return FamilyEnum::GEOGRAPHY; } /** - * Initialize the family of the object. + * Initialize the type of the object. */ - protected function initFamily(): FamilyEnum + public function getType(): string { - return FamilyEnum::GEOGRAPHY; + return TypeEnum::MULTIPOLYGON->value; } /** - * Initialize the type of the object. + * Initialize the dimension of the object. */ - protected function initType(): TypeEnum + protected function getDimension(): DimensionEnum { - return TypeEnum::MULTIPOLYGON; + return DimensionEnum::X_Y; } } diff --git a/lib/LongitudeOne/SpatialTypes/Types/Geography/Point.php b/lib/LongitudeOne/SpatialTypes/Types/Geography/Point.php index 3af1289..97c5e34 100644 --- a/lib/LongitudeOne/SpatialTypes/Types/Geography/Point.php +++ b/lib/LongitudeOne/SpatialTypes/Types/Geography/Point.php @@ -45,12 +45,21 @@ class Point extends AbstractPoint implements PointInterface */ public function __construct(float|int|string $x, float|int|string $y, ?int $srid = null) { - $this->preConstruct(); $this->setLongitude($x); $this->setLatitude($y); $this->srid = $srid; } + /** + * Initialize the family. + * + * @return FamilyEnum::GEOGRAPHY + */ + public function getFamily(): FamilyEnum + { + return FamilyEnum::GEOGRAPHY; + } + /** * Return the M coordinate of this point. * @@ -58,7 +67,15 @@ public function __construct(float|int|string $x, float|int|string $y, ?int $srid */ public function getM(): float|int { - throw BadMethodCallException::create(__METHOD__, $this->dimension); + throw BadMethodCallException::create(__METHOD__, $this->getDimension()); + } + + /** + * Initialize the type. + */ + public function getType(): string + { + return TypeEnum::POINT->value; } /** @@ -68,7 +85,7 @@ public function getM(): float|int */ public function getZ(): float|int { - throw BadMethodCallException::create(__METHOD__, $this->dimension); + throw BadMethodCallException::create(__METHOD__, $this->getDimension()); } /** @@ -100,28 +117,8 @@ public function setY(float|int|string $y): static * * @return DimensionEnum::X_Y */ - protected function initDimension(): DimensionEnum + protected function getDimension(): DimensionEnum { return DimensionEnum::X_Y; } - - /** - * Initialize the family. - * - * @return FamilyEnum::GEOGRAPHY - */ - protected function initFamily(): FamilyEnum - { - return FamilyEnum::GEOGRAPHY; - } - - /** - * Initialize the type. - * - * @return TypeEnum::POINT - */ - protected function initType(): TypeEnum - { - return TypeEnum::POINT; - } } diff --git a/lib/LongitudeOne/SpatialTypes/Types/Geography/Polygon.php b/lib/LongitudeOne/SpatialTypes/Types/Geography/Polygon.php index d508770..407da21 100644 --- a/lib/LongitudeOne/SpatialTypes/Types/Geography/Polygon.php +++ b/lib/LongitudeOne/SpatialTypes/Types/Geography/Polygon.php @@ -25,26 +25,26 @@ class Polygon extends AbstractPolygon implements PolygonInterface { /** - * Initialize the dimension of the object. + * Initialize the family of the object. */ - protected function initDimension(): DimensionEnum + public function getFamily(): FamilyEnum { - return DimensionEnum::X_Y; + return FamilyEnum::GEOGRAPHY; } /** - * Initialize the family of the object. + * Initialize the type of the object. */ - protected function initFamily(): FamilyEnum + public function getType(): string { - return FamilyEnum::GEOGRAPHY; + return TypeEnum::POLYGON->value; } /** - * Initialize the type of the object. + * Initialize the dimension of the object. */ - protected function initType(): TypeEnum + protected function getDimension(): DimensionEnum { - return TypeEnum::POLYGON; + return DimensionEnum::X_Y; } } diff --git a/lib/LongitudeOne/SpatialTypes/Types/Geometry/GeometryCollection.php b/lib/LongitudeOne/SpatialTypes/Types/Geometry/GeometryCollection.php index 6b35b64..cac9dc1 100644 --- a/lib/LongitudeOne/SpatialTypes/Types/Geometry/GeometryCollection.php +++ b/lib/LongitudeOne/SpatialTypes/Types/Geometry/GeometryCollection.php @@ -25,26 +25,26 @@ class GeometryCollection extends AbstractCollection implements CollectionInterface { /** - * initDimension. + * init Family. */ - protected function initDimension(): DimensionEnum + public function getFamily(): FamilyEnum { - return DimensionEnum::X_Y; + return FamilyEnum::GEOMETRY; } /** - * init Family. + * initType. */ - protected function initFamily(): FamilyEnum + public function getType(): string { - return FamilyEnum::GEOMETRY; + return TypeEnum::COLLECTION->value; } /** - * initType. + * initDimension. */ - protected function initType(): TypeEnum + protected function getDimension(): DimensionEnum { - return TypeEnum::COLLECTION; + return DimensionEnum::X_Y; } } diff --git a/lib/LongitudeOne/SpatialTypes/Types/Geometry/LineString.php b/lib/LongitudeOne/SpatialTypes/Types/Geometry/LineString.php index ac1fa82..734d6d3 100644 --- a/lib/LongitudeOne/SpatialTypes/Types/Geometry/LineString.php +++ b/lib/LongitudeOne/SpatialTypes/Types/Geometry/LineString.php @@ -25,26 +25,26 @@ class LineString extends AbstractLineString implements LineStringInterface { /** - * Define the dimension. + * Define the family. */ - protected function initDimension(): DimensionEnum + public function getFamily(): FamilyEnum { - return DimensionEnum::X_Y; + return FamilyEnum::GEOMETRY; } /** - * Define the family. + * Define the type. */ - protected function initFamily(): FamilyEnum + public function getType(): string { - return FamilyEnum::GEOMETRY; + return TypeEnum::LINESTRING->value; } /** - * Define the type. + * Define the dimension. */ - protected function initType(): TypeEnum + protected function getDimension(): DimensionEnum { - return TypeEnum::LINESTRING; + return DimensionEnum::X_Y; } } diff --git a/lib/LongitudeOne/SpatialTypes/Types/Geometry/MultiLineString.php b/lib/LongitudeOne/SpatialTypes/Types/Geometry/MultiLineString.php index b8bf683..81534aa 100644 --- a/lib/LongitudeOne/SpatialTypes/Types/Geometry/MultiLineString.php +++ b/lib/LongitudeOne/SpatialTypes/Types/Geometry/MultiLineString.php @@ -25,26 +25,26 @@ class MultiLineString extends AbstractMultiLineString implements MultiLineStringInterface { /** - * Initialize the dimension of the object. + * Initialize the family of the object. */ - protected function initDimension(): DimensionEnum + public function getFamily(): FamilyEnum { - return DimensionEnum::X_Y; + return FamilyEnum::GEOMETRY; } /** - * Initialize the family of the object. + * Initialize the type of the object. */ - protected function initFamily(): FamilyEnum + public function getType(): string { - return FamilyEnum::GEOMETRY; + return TypeEnum::MULTILINESTRING->value; } /** - * Initialize the type of the object. + * Initialize the dimension of the object. */ - protected function initType(): TypeEnum + protected function getDimension(): DimensionEnum { - return TypeEnum::MULTILINESTRING; + return DimensionEnum::X_Y; } } diff --git a/lib/LongitudeOne/SpatialTypes/Types/Geometry/MultiPoint.php b/lib/LongitudeOne/SpatialTypes/Types/Geometry/MultiPoint.php index 92c99df..d97d670 100644 --- a/lib/LongitudeOne/SpatialTypes/Types/Geometry/MultiPoint.php +++ b/lib/LongitudeOne/SpatialTypes/Types/Geometry/MultiPoint.php @@ -25,26 +25,26 @@ class MultiPoint extends AbstractMultiPoint implements MultiPointInterface { /** - * Define the dimension. + * Define the family. */ - protected function initDimension(): DimensionEnum + public function getFamily(): FamilyEnum { - return DimensionEnum::X_Y; + return FamilyEnum::GEOMETRY; } /** - * Define the family. + * Define the type. */ - protected function initFamily(): FamilyEnum + public function getType(): string { - return FamilyEnum::GEOMETRY; + return TypeEnum::MULTIPOINT->value; } /** - * Define the type. + * Define the dimension. */ - protected function initType(): TypeEnum + protected function getDimension(): DimensionEnum { - return TypeEnum::MULTIPOINT; + return DimensionEnum::X_Y; } } diff --git a/lib/LongitudeOne/SpatialTypes/Types/Geometry/MultiPolygon.php b/lib/LongitudeOne/SpatialTypes/Types/Geometry/MultiPolygon.php index 765fbdc..97f194f 100644 --- a/lib/LongitudeOne/SpatialTypes/Types/Geometry/MultiPolygon.php +++ b/lib/LongitudeOne/SpatialTypes/Types/Geometry/MultiPolygon.php @@ -25,26 +25,26 @@ class MultiPolygon extends AbstractMultiPolygon implements MultiPolygonInterface { /** - * Initialize the dimension of the object. + * Initialize the family of the object. */ - protected function initDimension(): DimensionEnum + public function getFamily(): FamilyEnum { - return DimensionEnum::X_Y; + return FamilyEnum::GEOMETRY; } /** - * Initialize the family of the object. + * Initialize the type of the object. */ - protected function initFamily(): FamilyEnum + public function getType(): string { - return FamilyEnum::GEOMETRY; + return TypeEnum::MULTIPOLYGON->value; } /** - * Initialize the type of the object. + * Initialize the dimension of the object. */ - protected function initType(): TypeEnum + protected function getDimension(): DimensionEnum { - return TypeEnum::MULTIPOLYGON; + return DimensionEnum::X_Y; } } diff --git a/lib/LongitudeOne/SpatialTypes/Types/Geometry/Point.php b/lib/LongitudeOne/SpatialTypes/Types/Geometry/Point.php index 958226a..8437205 100644 --- a/lib/LongitudeOne/SpatialTypes/Types/Geometry/Point.php +++ b/lib/LongitudeOne/SpatialTypes/Types/Geometry/Point.php @@ -45,59 +45,56 @@ class Point extends AbstractPoint implements PointInterface */ public function __construct(float|int|string $x, float|int|string $y, ?int $srid = null) { - $this->preConstruct(); $this->setX($x); $this->setY($y); $this->srid = $srid; } /** - * Return the M coordinate of this point. + * Initialize the family. * - * @throws BadMethodCallException because the point has no M coordinate + * @return FamilyEnum::GEOMETRY */ - public function getM(): float|int + public function getFamily(): FamilyEnum { - throw BadMethodCallException::create(__METHOD__, $this->dimension); + return FamilyEnum::GEOMETRY; } /** - * Get the Z coordinate (elevation). + * Return the M coordinate of this point. * - * @throws BadMethodCallException because the point has no Z coordinate + * @throws BadMethodCallException because the point has no M coordinate */ - public function getZ(): float|int + public function getM(): float|int { - throw BadMethodCallException::create(__METHOD__, $this->dimension); + throw BadMethodCallException::create(__METHOD__, $this->getDimension()); } /** - * Initialize the dimension. - * - * @return DimensionEnum::X_Y + * Initialize the type. */ - protected function initDimension(): DimensionEnum + public function getType(): string { - return DimensionEnum::X_Y; + return TypeEnum::POINT->value; } /** - * Initialize the family. + * Get the Z coordinate (elevation). * - * @return FamilyEnum::GEOMETRY + * @throws BadMethodCallException because the point has no Z coordinate */ - protected function initFamily(): FamilyEnum + public function getZ(): float|int { - return FamilyEnum::GEOMETRY; + throw BadMethodCallException::create(__METHOD__, $this->getDimension()); } /** - * Initialize the type. + * Initialize the dimension. * - * @return TypeEnum::POINT + * @return DimensionEnum::X_Y */ - protected function initType(): TypeEnum + protected function getDimension(): DimensionEnum { - return TypeEnum::POINT; + return DimensionEnum::X_Y; } } diff --git a/lib/LongitudeOne/SpatialTypes/Types/Geometry/Polygon.php b/lib/LongitudeOne/SpatialTypes/Types/Geometry/Polygon.php index a99cd04..34abf88 100644 --- a/lib/LongitudeOne/SpatialTypes/Types/Geometry/Polygon.php +++ b/lib/LongitudeOne/SpatialTypes/Types/Geometry/Polygon.php @@ -25,26 +25,26 @@ class Polygon extends AbstractPolygon implements PolygonInterface { /** - * Initialize the dimension of the object. + * Declare the family of the object. */ - protected function initDimension(): DimensionEnum + public function getFamily(): FamilyEnum { - return DimensionEnum::X_Y; + return FamilyEnum::GEOMETRY; } /** - * Initialize the family of the object. + * Declare the type of the object. */ - protected function initFamily(): FamilyEnum + public function getType(): string { - return FamilyEnum::GEOMETRY; + return TypeEnum::POLYGON->value; } /** - * Initialize the type of the object. + * Declare the dimension of the object. */ - protected function initType(): TypeEnum + protected function getDimension(): DimensionEnum { - return TypeEnum::POLYGON; + return DimensionEnum::X_Y; } }