Converts an old FIPS region code to ISO

@param string $countryCode
@param string $fipsRegionCode
@param bool $returnOriginalIfNotFound  return given region code if no mapping was found
@return array
8356
public static function convertRegionCodeToIso($countryCode, $fipsRegionCode, $returnOriginalIfNotFound = false)
    {
        static $mapping;
        if(empty($mapping)) {
            $mapping = include __DIR__ . '/../data/regionMapping.php';
        }
        $countryCode = strtoupper($countryCode);
        if (empty($countryCode) || in_array($countryCode, ['EU', 'AP', 'A1', 'A2'])) {
            return ['', ''];
        }
        if (in_array($countryCode, ['US', 'CA'])) { // US and CA always haven been iso codes
            return [$countryCode, $fipsRegionCode];
        }
        if ($countryCode == 'TI') {
            $countryCode = 'CN';
            $fipsRegionCode = '14';
        }
        $isoRegionCode = $returnOriginalIfNotFound ? $fipsRegionCode : '';
        if (!empty($fipsRegionCode) && !empty($mapping[$countryCode][$fipsRegionCode])) {
            $isoRegionCode = $mapping[$countryCode][$fipsRegionCode];
        }
        return [$countryCode, $isoRegionCode];
    }
220350
public function populateCountry($countryCode)
    {
        $rootLocation = $this
            ->locationPopulatorAdapter
            ->populate($countryCode);

        $this
            ->locationObjectManager
            ->persist($rootLocation);

        $this
            ->locationObjectManager
            ->flush($rootLocation);

        return $this;
    }
740490
protected function buildCountry(
        string $countryIso3
    ) {
        $country = $this->findCountryByIso3->__invoke(
            $countryIso3
        );

        if (empty($country)) {
            throw new CountryNotFoundException(
                "Country {$countryIso3} could not be found."
            );
        }

        return $country;
    }
388013
public static function toISO1366Alpha2($countryCode)
    {
        if (!static::$data) {
            $file = fopen(__DIR__.'../../../data/countries.csv', 'r');
            while (!feof($file)) {
                $line = fgetcsv($file);
                static::$data[reset($line)] = end($line);
            }
        }

        return isset(static::$data[$countryCode]) ?
            static::$data[$countryCode] : false;
    }
1257366
public static boolean isSEPACountry(String countryCode) {
        int index = indexOf(countryCode);
        if (index > -1) {
            return (CountryCodes.COUNTRY_IBAN_LENGTHS[index] & SEPA) == SEPA;
        }
        return false;
    }
1287303
public function getCountryFromCode($code)
    {
        $code = strtoupper($code);
        $output = "Other";
        if (in_array($code, $this->countriesMapping)) {
            foreach ($this->countriesMapping as $country => $short) {
                if ($code == $short) {
                    $output = $country;
                    break;
                }
            }
        }

        return $output;
    }
167722
public function getCountryCode($country = null)
    {
        if ($country === null) {
            $country = $this->_country;
        }

        $code = KlarnaCountry::getCode($country);
        return (string) $code;
    }
37836
public static function country_name_from_code($country_code)
    {
        try {
            $source = Zend_Locale::getTranslationList(
                'territory',
                $country_code,
                2
            );

            return (array_key_exists($country_code, $source)) ? $source[$country_code] : $country_code;
        } catch (Exception $e) {
            return "";
        }
    }
670796
public function getCountryIdFromAmazonCountryCode($amazonCountryCode, $targetAddressType)
    {
        $countryObject = TdbDataCountry::GetInstanceForIsoCode($amazonCountryCode);
        if (null === $countryObject || false === $this->isCountryForAddressTypeActive($countryObject, $targetAddressType)) {
            throw new InvalidArgumentException('country code '.$amazonCountryCode.' is not supported');
        }

        return $countryObject->id;
    }
924452
public static function getLocaleByCode($languageCode, $countryCode = null) {
		$class = 'Dater\Locale\\' . ucfirst(strtolower($languageCode)) . ($countryCode ? ucfirst(strtolower($countryCode)) : '');
		if(!class_exists($class)) {
			throw new \Exception('Unknown locale code. Class "' . $class . '" not found.');
		}
		return new $class();
	}
731016
protected function getIdCountryFromCache($iso2Code, $iso3Code)
    {
        if ($iso2Code !== null && isset($this->idCountryCache[$iso2Code])) {
            return $this->idCountryCache[$iso2Code];
        }

        if ($iso3Code !== null && isset($this->idCountryCache[$iso3Code])) {
            return $this->idCountryCache[$iso3Code];
        }

        return false;
    }
132677
public function getCountryList($includeInternalCodes = false)
    {
        if ($this->countryList === null) {
            $this->countryList = require __DIR__ . '/../Resources/countries.php';
        }
        if ($this->countryExtraList === null) {
            $this->countryExtraList = require __DIR__ . '/../Resources/countries-extra.php';
        }

        if ($includeInternalCodes) {
            return array_merge($this->countryList, $this->countryExtraList);
        }

        return $this->countryList;
    }
864653
public static function countryLanguageCodes($countryCode)
    {
        $localeCodes = Locale::countryLocaleCodes($countryCode);

        $list = [];
        foreach ($localeCodes as $localeCode) {
            $list[] = Locale::languageCode($localeCode);
        }

        return $list;
    }
1104902
public function formatForCountry($country)
    {
        if (! static::isValidCountryCode($country)) {
            throw CountryCodeException::invalid($country);
        }

        return $this->lib->formatOutOfCountryCallingNumber(
            $this->getPhoneNumberInstance(),
            $country
        );
    }
149986
public function formatCountry($country_code)
    {
        $this->setCountry($country_code);
        $this->setTitleFormatCountry();
        $this->setBreadcrumbFormatCountry();

        $this->setData('format', $this->data_country['format']);

        $this->submitFormatCountry();
        $this->outputFormatCountry();
    }
265087
public function createSubFormsCreator($countryIso2Code)
    {
        if (isset($this->subFormsCreators[$countryIso2Code])) {
            $subFormsCreator = $this->subFormsCreators[$countryIso2Code]();
        } else {
            $subFormsCreator = $this->subFormsCreators[self::DEFAULT_COUNTRY]();
        }

        return $subFormsCreator;
    }
834236
public function getCountryDialingCode ($country_code) {
			$country_code = strtoupper($country_code);

			if (!isset($this->cache['country_codes']))
				$this->cache['country_codes'] = array();

			if (!isset($this->cache['country_codes'][$country_code])) {
				$tmp = $this->apiCall('get_pricing', array('country_code'=>$country_code));
				if (!$tmp['data']) return false;

				$this->cache['country_codes'][$country_code] = $tmp['data'];
			}

			return (string)$this->cache['country_codes'][$country_code]['prefix'];
		}