libphonenumber\PhoneNumberUtil::getMetadataForNonGeographicalRegion PHP Method

getMetadataForNonGeographicalRegion() public method

public getMetadataForNonGeographicalRegion ( integer $countryCallingCode ) : PhoneMetadata
$countryCallingCode integer
return PhoneMetadata
    public function getMetadataForNonGeographicalRegion($countryCallingCode)
    {
        if (!isset($this->countryCallingCodeToRegionCodeMap[$countryCallingCode])) {
            return null;
        }
        return $this->metadataSource->getMetadataForNonGeographicalRegion($countryCallingCode);
    }

Usage Example

 public function testGetInstanceLoadInternationalTollFreeMetadata()
 {
     $metadata = $this->phoneUtil->getMetadataForNonGeographicalRegion(800);
     $this->assertEquals("001", $metadata->getId());
     $this->assertEquals(800, $metadata->getCountryCode());
     $this->assertEquals("\$1 \$2", $metadata->getNumberFormat(0)->getFormat());
     $this->assertEquals("(\\d{4})(\\d{4})", $metadata->getNumberFormat(0)->getPattern());
     $this->assertEquals("12345678", $metadata->getGeneralDesc()->getExampleNumber());
     $this->assertEquals("12345678", $metadata->getTollFree()->getExampleNumber());
 }
PhoneNumberUtil