alcohol/iso3166

BC Break: currency key should consistently be an array

Closed this issue · 2 comments

the currency key should be standardized to being an array. sometimes the country has 1 currency, but sometimes more. I believe it would be easier to standardize or add a currencies key where the data is in an array of ISO4217 code. This way when calling this index you don't have to make a check before using the data.

$country['currencies'] = !is_array($country['currency']) ? [$country['currency']] : $country['currency'];
/// now you have a normalized currency index to work with in you code.

I was wondering, is this really a BC break though? Currently you can receive either a string or an array, implying you should be capable of handling both. If we change everything to array, you simply need to handle one scenario less.

it depends if someone expect for instance the 'FR' entry to return a string an now it returns an array it's BC breaking. but if you normalized the return maybe it could be considered to be a fix.... it depends