Skip to content

Commit

Permalink
Fix issues with currencies longlist retrieval (fix #167)
Browse files Browse the repository at this point in the history
  • Loading branch information
Omranic committed Oct 3, 2021
1 parent e93cf72 commit 1475ba9
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/CurrencyLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,18 @@ public static function currencies($longlist = false): array
foreach ($countries as $country) {
if ($longlist) {
foreach ($country['currency'] as $currency => $details) {
static::$currencies[$list][$currency] = $longlist ? $details : $currency;
! $currency || static::$currencies[$list][$currency] = $longlist ? $details : $currency;
}
} else {
static::$currencies[$list][] = $country['currency'];
! $country['currency'] || static::$currencies[$list][$country['currency']] = $country['currency'];
}
}
}

$currencies = array_filter(array_unique(static::$currencies[$list]), function ($item) {
return is_string($item);
});
$currencies = static::$currencies[$list];

sort($currencies);
ksort($currencies);

return array_combine($currencies, $currencies);
return $currencies;
}
}

0 comments on commit 1475ba9

Please sign in to comment.