src/AsYouTypeFormatter.php
private function getMetadataForRegion($regionCode)
    {
        $countryCallingCode = $this->phoneUtil->getCountryCodeForRegion($regionCode);
        $mainCountry = $this->phoneUtil->getRegionCodeForCountryCode($countryCallingCode);
        $metadata = $this->phoneUtil->getMetadataForRegion($mainCountry);
        if ($metadata !== null) {
            return $metadata;
        }
        // Set to a default instance of teh metadata. This allows us to function with an incorrect
        // region code, even if the formatting only works for numbers specified with "+".
        return self::$emptyMetadata;
    }
private function getMetadataForRegion($regionCode)
    {
        $countryCallingCode = $this->phoneUtil->getCountryCodeForRegion($regionCode);
        $mainCountry = $this->phoneUtil->getRegionCodeForCountryCode($countryCallingCode);
        $metadata = $this->phoneUtil->getMetadataForRegion($mainCountry);
        if ($metadata !== null) {
            return $metadata;
        }
        // Set to a default instance of teh metadata. This allows us to function with an incorrect
        // region code, even if the formatting only works for numbers specified with "+".
        return self::$emptyMetadata;
    }
private function getMetadataForRegion ( $ regionCode ) { $ countryCallingCode = $ this -> phoneUtil -> getCountryCodeForRegion ( $ regionCode ) ; $ mainCountry = $ this -> phoneUtil -> getRegionCodeForCountryCode ( $ countryCallingCode ) ; $ metadata = $ this -> phoneUtil -> getMetadataForRegion ( $ mainCountry ) ; if ( $ metadata !== null ) { return $ metadata ; } // Set to a default instance of teh metadata. This allows us to function with an incorrect // region code, even if the formatting only works for numbers specified with "+". return self :: $ emptyMetadata ; }
The metadata needed by this class is the same for all regions sharing the same country calling
code. Therefore, we return the metadata for the 'main' region for this country calling code.
@param string $regionCode
@return PhoneMetadata
The metadata needed by this class is the same for all regions sharing the same country calling code . Therefore we return the metadata for the main region for this country calling code .