Returns the country as the numeric ISO 3166-1 code

@throws InvalidRequestException

@return int ISO 3166-1 numeric country
511558
public function getNumericCountry()
    {
        $country = $this->getCountry();

        if ( !is_null($country) && !is_numeric($country) )
        {
            $iso3166 = new ISO3166();

            if ( strlen($country) == 2 )
            {
                $country = $iso3166->getByAlpha2($country)['numeric'];
            }
            elseif ( strlen($country) == 3 )
            {
                $country = $iso3166->getByAlpha3($country)['numeric'];
            }
            else
            {
                throw new InvalidRequestException("The country parameter must be ISO 3166-1 numeric, aplha2 or alpha3.");
            }
        }

        return $country;
    }
724038
public function getCountryCodeMapping()
    {
        $regionDataProvider = StaticContainer::get('Piwik\Intl\Data\Provider\RegionDataProvider');

        $countryCodeList = $regionDataProvider->getCountryList();

        array_walk($countryCodeList, function(&$item, $key) {
            $item = Piwik::translate('Intl_Country_'.strtoupper($key));
        });

        return $countryCodeList;
    }
162506
protected function getListCountry()
    {
        $code = $this->getParam(0);

        if (!isset($code)) {
            return $this->country->getList(array('limit' => $this->getLimit()));
        }

        $country = $this->country->get($code);

        if (empty($country)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        return array($country);
    }
164989
function country()
    {
        if ( $this->attribute( 'country_code' ) != '*' )
        {
            $countryINI = eZINI::instance( 'country.ini' );
            $countryName = $countryINI->variable( $this->attribute( 'country_code' ) , 'Name' );
        }
        else
        {
            $countryName = '*';
        }
        return $countryName;
    }
1112230
public static function fromNative()
    {
        $codeString = \func_get_arg(0);
        $code       = CountryCode::getByName($codeString);
        $country    = new self($code);

        return $country;
    }
925508
public function getCharset()
    {
        $charset = $this->getHeaderParameter('Content-Type', 'charset');
        if ($charset === null) {
            $contentType = $this->getContentType();
            if ($contentType === 'text/plain' || $contentType === 'text/html') {
                return 'ISO-8859-1';
            }
            return null;
        }
        return trim(strtoupper($charset));
    }
1152510
public function getCountryCode()
    {
        $localeIso = $this->locale->getIso();

        if (isset($this->localeCountryAssociations[$localeIso])) {
            return Locale::create($this->localeCountryAssociations[$localeIso]);
        }

        $regionLocale = \Locale::getRegion($localeIso);

        return $regionLocale
            ? Locale::create($regionLocale)
            : $this->locale;
    }
1254412
public function getPostalCode()
    {
        $canonicalizer = new PostalCodeCanonicalizer();

        return $canonicalizer->canonicalizeForCountry($this->address->getPostalCode(), $this->address->getCountry());
    }
1095359
public static function getCurrencySymbol($isocode) {
		return empty(self::$currencySymbols[$isocode])?$isocode:self::$currencySymbols[$isocode];
	}
1270139
protected function getCountryFormatAddress()
    {
        $updating = $this->getUpdating();

        if (isset($updating['country_format'])) {
            return $updating['country_format'];
        }

        $field = 'country';
        $code = $this->getSubmitted($field);

        if (!isset($code)) {
            return $this->country->getDefaultFormat();
        }

        $country = $this->country->get($code);

        if (empty($country['format'])) {
            $this->setErrorUnavailable($field, $this->translation->text('Country'));
            return array();
        }

        return $country['format'];
    }
870707
public function getDescription4CountryCode(string $cntry): string
    {
        $query = $this->createQueryBuilder('p')
            ->select('p')
            ->where('p.cntry = :sCntry')
            ->setParameter('sCntry', $cntry)
            ->setMaxResults(1)
            ->getQuery();

        /** @var \PServerCore\Entity\CountryList $result */
        $result = $query->getOneOrNullResult();

        // no country found
        if (!$result) {
            return 'ZZZ';
        }

        return $result->getCountry();
    }
219659
public function getCode(): int {
        if ($status = $this->getMainCode()) {
            return $status;
        }

        if ($this->isValid()) {
            return 200;
        }

        // There was no status so loop through the errors and look for the highest one.
        $max = 0;
        foreach ($this->getRawErrors() as $error) {
            if (isset($error['code']) && $error['code'] > $max) {
                $max = $error['code'];
            }
        }

        return $max ?: 400;
    }
125786
public function getRegionCode()
    {
        \preg_match('~^(?<region_digits>[\d]{2}).+$~', $this->getValue(), $matches);

        if (isset($matches['region_digits']) && \is_numeric($region_digits = (string) $matches['region_digits'])) {
            return (int) $region_digits;
        }
    }
751986
public function getCurrencyCode()
    {
        $currency = $this->paymentBridge->getCurrency();

        $constantName = sprintf('%s::%s', Currency::class, strtoupper($currency));

        if (!defined($constantName)) {
            throw new CurrencyNotSupportedException();
        }

        return constant($constantName);
    }
936569
public function getFormatter()
    {
        $locale = $this->getLocale();
        $currency = $this->getCurrency();
        if ($currency) {
            $locale .= '@currency=' . $currency;
        }
        return NumberFormatter::create($locale, NumberFormatter::CURRENCY);
    }
1049121
private static int parseCountryCode(String countryCode) {

    String normalized = countryCode;
    if (normalized.startsWith(InternationalCallPrefix.PREFIX_PLUS)) {
      normalized = normalized.substring(1);
    } else if (normalized.startsWith(InternationalCallPrefix.PREFIX_00)) {
      normalized = normalized.substring(2);
    } else if (normalized.startsWith(InternationalCallPrefix.PREFIX_011)) {
      normalized = normalized.substring(3);
    }
    if (normalized.startsWith("0")) {
      throw new IllegalArgumentException(countryCode);
    }
    try {
      int cc = Integer.parseInt(normalized);
      return cc;
    } catch (NumberFormatException e) {
      throw new IllegalArgumentException(countryCode, e);
    }
  }
80875
private function isLengthValid()
    {
        $countryCode = $this->getCountryCode();
        $validLength = static::COUNTRY_CODE_LENGTH + static::CHECKSUM_LENGTH + static::$ibanFormatMap[$countryCode][0];

        return strlen($this->iban) === $validLength;
    }