public function fromHash($hash)
{
if ($hash === null) {
return $this->getEmptyValue();
}
$countries = array();
foreach ($hash as $country) {
foreach ($this->countriesInfo as $countryInfo) {
switch ($country) {
case $countryInfo['Name']:
case $countryInfo['Alpha2']:
case $countryInfo['Alpha3']:
$countries[$countryInfo['Alpha2']] = $countryInfo;
continue 3;
}
}
throw new InvalidValue($country);
}
return new Value($countries);
}