Skip to content

Commit 3f1bef2

Browse files
committed
following feedback
1 parent e6a937e commit 3f1bef2

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/Geometry/MinMaxUtils.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Mindee\Geometry;
44

5+
use Mindee\Error\ErrorCode;
56
use Mindee\Error\MindeeGeometryException;
67

78
/**
@@ -20,7 +21,8 @@ public static function getMinMaxY(array $points): MinMax
2021
{
2122
if (count($points) < 1) {
2223
throw new MindeeGeometryException(
23-
'The provided point array must have at least 1 point to calculate the Y bounds.'
24+
'The provided point array must have at least 1 point to calculate the Y bounds.',
25+
ErrorCode::GEOMETRIC_OPERATION_FAILED
2426
);
2527
}
2628
$yCoords = [];
@@ -41,7 +43,8 @@ public static function getMinMaxX(array $points): MinMax
4143
{
4244
if (count($points) < 1) {
4345
throw new MindeeGeometryException(
44-
'The provided point array must have at least 1 point to calculate the X bounds.'
46+
'The provided point array must have at least 1 point to calculate the X bounds.',
47+
ErrorCode::GEOMETRIC_OPERATION_FAILED
4548
);
4649
}
4750
$xCoords = [];

src/Geometry/PolygonUtils.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Mindee\Geometry;
44

5+
use Mindee\Error\ErrorCode;
56
use Mindee\Error\MindeeGeometryException;
67

78
/**
@@ -57,8 +58,11 @@ public static function compareOnY(Polygon $polygon1, Polygon $polygon2): int
5758
*/
5859
public static function merge(Polygon $base, Polygon $target): Polygon
5960
{
60-
if ((!$base->getCoordinates()) && (!$target || !$target->getCoordinates())) {
61-
throw new MindeeGeometryException('Cannot merge two empty polygons.');
61+
if ((!$base->getCoordinates()) && (!$target->getCoordinates())) {
62+
throw new MindeeGeometryException(
63+
'Cannot merge two empty polygons.',
64+
ErrorCode::GEOMETRIC_OPERATION_FAILED
65+
);
6266
}
6367
if (!$base->getCoordinates()) {
6468
return $target;

0 commit comments

Comments
 (0)