returns array of phone types for check for current country data

 ==== Attributes

 * +data+  - country data hash
191250
def types_for_check(data)
      exclude_list = PhoneAnalyzer::NOT_FOR_CHECK
      exclude_list += Phonelib::Core::SHORT_CODES unless Phonelib.parse_special
      Core::TYPES_DESC.keys - exclude_list + fixed_and_mobile_keys(data)
    end
1035302
def valid?
      phone_type_validator = EnumAttributeValidator.new('String', ["Cell", "Home", "Work", "Other", ""])
      return false unless phone_type_validator.valid?(@phone_type)
      relationship_validator = EnumAttributeValidator.new('String', ["Parent", "Grandparent", "Self", "Aunt/Uncle", "Sibling", "Other", ""])
      return false unless relationship_validator.valid?(@relationship)
      type_validator = EnumAttributeValidator.new('String', ["Parent/Guardian", "Emergency", "Primary", "Secondary", "Family", "Other", ""])
      return false unless type_validator.valid?(@type)
      return true
    end
642648
function getType(number, countryCode) {
    try {
        var phoneUtil = i18n.phonenumbers.PhoneNumberUtil.getInstance();
        var numberObj = phoneUtil.parseAndKeepRawInput(number, countryCode);
        return phoneUtil.getNumberType(numberObj)
    } catch (e) {
        // broken
        return -99;
    }
}
1220798
public function getPhoneNumbersFormatted()
    {
        $formattedArray = [];
        foreach ($this->phoneNumbers as $key => $phoneNumber)
        {
            $formattedArray[$key] = [
                'number' => $phoneNumber->getNumber(),
                'extension' => null
            ];
        }

        return $formattedArray;
    }
1209152
public function getSupportedLocationInfo()
    {
        return array(self::CONTINENT_CODE_KEY => true,
                     self::CONTINENT_NAME_KEY => true,
                     self::COUNTRY_CODE_KEY   => true,
                     self::COUNTRY_NAME_KEY   => true);
    }
73634
def national_and_data(data, country_match, not_valid = false)
      result = data.select { |k, _v| k != :types && k != :formats }
      phone = country_match.to_a.last
      result[:national] = phone
      result[:format] = number_format(phone, data[Core::FORMATS])
      result.merge! all_number_types(phone, data[Core::TYPES], not_valid)
      result[:valid] = [] if not_valid

      { result[:id] => result }
    end
930120
function could_phone_number_belong_to_country(phone_number, country_code, metadata)
{
	// Strip the leading `+`
	const phone_number_digits = phone_number.slice('+'.length)

	for (const country_phone_code of Object.keys(metadata.country_phone_code_to_countries))
	{
		const possible_country_phone_code = phone_number_digits.substring(0, country_phone_code.length)
		if (country_phone_code.indexOf(possible_country_phone_code) === 0)
		{
			// This country phone code is possible.
			// Does the given country correspond to this country phone code.
			if (metadata.country_phone_code_to_countries[country_phone_code].indexOf(country_code) >= 0)
			{
				return true
			}
		}
	}
}
653576
def get_country_by_name(self, country_name: str) -> typing.Optional['Country']:
        
        VALID_STR.validate(country_name, 'get_country_by_name', exc=ValueError)
        if country_name not in self._countries_by_name.keys():
            for country in self.countries:

                if country.country_name == country_name:
                    self._countries_by_name[country_name] = country
                    return country
            raise ValueError(country_name)
        else:
            return self._countries_by_name[country_name]
577354
def all
      rules = []

      raw.each do |type, details|
        # Add general rules
        Array(details['prefix']).each do |prefix|
          rules.push({
            prefix: prefix.to_s,
            length: details['length'],
            type:   type
          })
        end

        # Process each country
        Array(details['countries']).each do |country, prefixes|
          # Add a rule for each prefix
          Array(prefixes).each do |prefix|
            rules.push({
              prefix: prefix.to_s,
              length: details['length'],
              type:   type,
              country: country,
            })
          end
        end

      end

      # Sort by prefix length
      rules.sort { |x, y|  y[:prefix].length <=> x[:prefix].length }
    end
1958
public static function countriesList()
    {
        $path = dirname(realpath(__FILE__)).DIRECTORY_SEPARATOR.'data/countries.json';
        $countries = self::readJson($path, true);

        $listCountries = [];

        foreach ($countries['Names'] as $code => $value) {
            $listCountries[$code] = $value;
        }

        return $listCountries;
    }
1319079
public function getApplePaySupportedCountries() {
        $supportedCountries = $this->scopeConfig->getValue(
            'payment/checkout_com_applepay/supported_countries',
            ScopeInterface::SCOPE_STORE
        );

        return !empty($supportedCountries) ? $supportedCountries : 'US,GB';
    }
883120
def full_regex_for_data(data, type, country_optional = true)
      regex = []
      regex << '0{2}?'
      regex << "(#{data[Core::INTERNATIONAL_PREFIX]})?"
      regex << "(#{data[Core::COUNTRY_CODE]})#{country_optional ? '?' : ''}"
      regex << "(#{data[Core::NATIONAL_PREFIX_FOR_PARSING] || data[Core::NATIONAL_PREFIX]})?"
      regex << "(#{type_regex(data[Core::TYPES][Core::GENERAL], type)})" if data[Core::TYPES]

      cr("^#{regex.join}$")
    end
548968
def parse_country(phone, country)
      data = Phonelib.phone_data[country]
      return nil unless data

      # if country was provided and it's a valid country, trying to
      # create e164 representation of phone number,
      # kind of normalization for parsing
      e164 = convert_to_e164 with_replaced_national_prefix(phone, data), data
      # if phone starts with international prefix of provided
      # country try to reanalyze without international prefix for
      # all countries
      return analyze(e164[1..-1], nil) if Core::PLUS_SIGN == e164[0]
      # trying to parse number for provided country
      parse_single_country e164, data
    end
839702
def _parse_phone(self, val):
        

        ret = {
            'type': None,
            'value': None
        }

        try:

            ret['type'] = val[1]['type']

        except (IndexError, KeyError, ValueError, TypeError):

                pass

        ret['value'] = val[3].strip()

        try:

            self.vars['phone'].append(ret)

        except AttributeError:

            self.vars['phone'] = []
            self.vars['phone'].append(ret)
217696
public static CountryList getCountries(Context context) {
        if (mCountries != null) {
            return mCountries;
        }
        mCountries = new CountryList();
        try {
            JSONArray countries = new JSONArray(getJsonFromRaw(context, R.raw.countries));
            for (int i = 0; i < countries.length(); i++) {
                try {
                    JSONObject country = (JSONObject) countries.get(i);
                    mCountries.add(new Country(country.getString("name"), country.getString("iso2"), country.getInt("dialCode")));
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return mCountries;
    }
1285139
def _get_localized_field_checks(self):
        
        localized_fields_checks = []
        for localized_field in self.instance.localized_fields:
            if self.cleaned_data.get(localized_field) is None:
                continue
            f = getattr(self.instance.__class__, localized_field, None)
            if f and f.unique:
                if f.unique:
                    local_name = get_real_fieldname(localized_field, self.language)
                    localized_fields_checks.append((localized_field, local_name))
                    
        return localized_fields_checks
12336
function strip_country_phone_code(formatted_number, metadata)
{
	if (!formatted_number || formatted_number[0] !== '+' || formatted_number === '+')
	{
		return formatted_number
	}

	for (const country_phone_code of Object.keys(metadata.country_phone_code_to_countries))
	{
		if (formatted_number.indexOf(country_phone_code) === '+'.length)
		{
			return formatted_number.slice('+'.length + country_phone_code.length).trim()
		}
	}

	return formatted_number
}