libphonenumber\PhoneNumberUtil::getCountryCodeForValidRegion PHP Method

getCountryCodeForValidRegion() protected method

Returns the country calling code for a specific region. For example, this would be 1 for the United States, and 64 for New Zealand. Assumes the region is already valid.
protected getCountryCodeForValidRegion ( string $regionCode ) : integer
$regionCode string the region that we want to get the country calling code for
return integer the country calling code for the region denoted by regionCode
    protected function getCountryCodeForValidRegion($regionCode)
    {
        $metadata = $this->getMetadataForRegion($regionCode);
        if ($metadata === null) {
            throw new \InvalidArgumentException("Invalid region code: " . $regionCode);
        }
        return $metadata->getCountryCode();
    }
PhoneNumberUtil