Point model: better handling of exception

This commit is contained in:
nobohan 2021-04-30 13:27:33 +02:00
parent 05d3d7f5c7
commit bec0700d39

View File

@ -60,14 +60,14 @@ class Point implements JsonSerializable {
throw PointException::badJsonString($geojson); throw PointException::badJsonString($geojson);
} }
if ($a->type != "Point"){ if ($a->type != 'Point'){
throw PointException::badGeoType(); throw PointException::badGeoType();
} else {
$lat = $a->coordinates[1];
$lon = $a->coordinates[0];
return Point::fromLonLat($lon, $lat);
} }
$lat = $a->coordinates[1];
$lon = $a->coordinates[0];
return Point::fromLonLat($lon, $lat);
} }
public static function fromLonLat(float $lon, float $lat): Point public static function fromLonLat(float $lon, float $lat): Point