Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LimberHope committed Dec 11, 2024
1 parent 63c94ba commit e2f269f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/Helpers/RestorationByEcoregionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

class RestorationByEcoregionHelper
{
public static function getCategoryEcoRegion($value, ?bool $isExport = false) {
public static function getCategoryEcoRegion($value, ?bool $isExport = false)
{
$categoriesFromEcoRegion = [
'australasian' => [
'Southeast Australia temperate forests',
Expand Down Expand Up @@ -47,20 +48,21 @@ public static function getCategoryEcoRegion($value, ?bool $isExport = false) {
],
'paleartic' => [
'southern-zanzibar-inhambane-coastal-forest-mosaic',
]
],
];
$formatedValue = [];
foreach ($categoriesFromEcoRegion as $category => $values) {
$formatedValue[$category] = 0;
foreach ($value as $key => $val) {
if (in_array($key, $values)) {
$formatedValue[$category] = round((float) $val, 3);

break;
}
}
}
$result = array_filter($formatedValue, function($val) {

$result = array_filter($formatedValue, function ($val) {
return $val !== 0;
});

Expand Down

0 comments on commit e2f269f

Please sign in to comment.