Skip to content

Commit

Permalink
[TM-1531] lint
Browse files Browse the repository at this point in the history
  • Loading branch information
egrojMonroy committed Dec 19, 2024
1 parent 039e9be commit 636dccc
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions app/Services/PolygonService.php
Original file line number Diff line number Diff line change
Expand Up @@ -547,26 +547,29 @@ public function insertGeojsonToDBFromContent(string $geojsonData, ?string $entit
$geojson = json_decode($geojsonData, true);
SitePolygonValidator::validate('FEATURE_BOUNDS', $geojson, false);
SitePolygonValidator::validate('GEOMETRY_TYPE', $geojson, false);

return $this->createGeojsonModels($geojson, ['site_id' => $entity_uuid, 'source' => PolygonService::UPLOADED_SOURCE], $primary_uuid, $submit_polygon_loaded);

} catch (Exception $e) {
$errorMessage = $e->getMessage();
$decodedError = json_decode($errorMessage, true);

if (json_last_error() === JSON_ERROR_NONE) {
Log::error('Validation error', ['error' => $decodedError]);

return [
'error' => json_encode($decodedError)
'error' => json_encode($decodedError),
];
} else {
Log::error('Validation error', ['error' => $errorMessage]);

return [
'error' => $errorMessage
'error' => $errorMessage,
];
}
}
}

public function processClippedPolygons(array $polygonUuids, $delayed_job_id = null)
{
$geojson = GeometryHelper::getPolygonsGeojson($polygonUuids);
Expand Down

0 comments on commit 636dccc

Please sign in to comment.