getId() public method

public getId ( ) : string
return string
 /**
  * Extracts the pattern for international format. If there is no intlFormat, default to using the
  * national format. If the intlFormat is set to "NA" the intlFormat should be ignored.
  *
  * @param PhoneMetadata $metadata
  * @param \DOMElement $numberFormatElement
  * @param NumberFormat $nationalFormat
  * @throws \RuntimeException if multiple intlFormats have been encountered.
  * @return bool whether an international number format is defined.
  */
 private static function loadInternationalFormat(PhoneMetadata $metadata, \DOMElement $numberFormatElement, NumberFormat $nationalFormat)
 {
     $intlFormat = new NumberFormat();
     $intlFormatPattern = $numberFormatElement->getElementsByTagName(self::INTL_FORMAT);
     $hasExplicitIntlFormatDefined = false;
     if ($intlFormatPattern->length > 1) {
         $countryId = strlen($metadata->getId()) > 0 ? $metadata->getId() : $metadata->getCountryCode();
         throw new \RuntimeException("Invalid number of intlFormat patterns for country: " . $countryId);
     } elseif ($intlFormatPattern->length == 0) {
         // Default to use the same as the national pattern if none is defined.
         $intlFormat->mergeFrom($nationalFormat);
     } else {
         $intlFormat->setPattern($numberFormatElement->getAttribute(self::PATTERN));
         self::setLeadingDigitsPatterns($numberFormatElement, $intlFormat);
         $intlFormatPatternValue = $intlFormatPattern->item(0)->firstChild->nodeValue;
         if ($intlFormatPatternValue !== "NA") {
             $intlFormat->setFormat($intlFormatPatternValue);
         }
         $hasExplicitIntlFormatDefined = true;
     }
     if ($intlFormat->hasFormat()) {
         $metadata->addIntlNumberFormat($intlFormat);
     }
     return $hasExplicitIntlFormatDefined;
 }
 /**
  * Extracts the pattern for the national format.
  *
  * @throws  RuntimeException if multiple or no formats have been encountered.
  * @return  the national format string.
  */
 private static function loadNationalFormat(PhoneMetadata $metadata, \DOMElement $numberFormatElement, NumberFormat $format)
 {
     self::setLeadingDigitsPatterns($numberFormatElement, $format);
     $format->setPattern($numberFormatElement->getAttribute(self::PATTERN));
     $formatPattern = $numberFormatElement->getElementsByTagName(self::FORMAT);
     if ($formatPattern->length != 1) {
         throw new \RuntimeException("Invalid number of format patterns for country: " . $metadata->getId());
     }
     $nationalFormat = $formatPattern->item(0)->firstChild->nodeValue;
     $format->setFormat($nationalFormat);
     return $nationalFormat;
 }