src/geocoding/PhoneNumberOfflineGeocoder.php
public function getDescriptionForNumber(PhoneNumber $number, $locale, $userRegion = null)
    {
        $numberType = $this->phoneUtil->getNumberType($number);

        if ($numberType === PhoneNumberType::UNKNOWN) {
            return '';
        }

        if (!$this->phoneUtil->isNumberGeographical($numberType, $number->getCountryCode())) {
            return $this->getCountryNameForNumber($number, $locale);
        }

        return $this->getDescriptionForValidNumber($number, $locale, $userRegion);
    }
public function getDescriptionForNumber(PhoneNumber $number, $locale, $userRegion = null)
    {
        $numberType = $this->phoneUtil->getNumberType($number);

        if ($numberType === PhoneNumberType::UNKNOWN) {
            return '';
        }

        if (!$this->phoneUtil->isNumberGeographical($numberType, $number->getCountryCode())) {
            return $this->getCountryNameForNumber($number, $locale);
        }

        return $this->getDescriptionForValidNumber($number, $locale, $userRegion);
    }
public function getDescriptionForNumber ( PhoneNumber $ number , $ locale , $ userRegion = null ) { $ numberType = $ this -> phoneUtil -> getNumberType ( $ number ) ; if ( $ numberType === PhoneNumberType :: UNKNOWN ) { return '' ; } if ( ! $ this -> phoneUtil -> isNumberGeographical ( $ numberType , $ number -> getCountryCode ( ) ) ) { return $ this -> getCountryNameForNumber ( $ number , $ locale ) ; } return $ this -> getDescriptionForValidNumber ( $ number , $ locale , $ userRegion ) ; }
As per getDescriptionForValidNumber, but explicitly checks the validity of the number
passed in.


@see getDescriptionForValidNumber
@param PhoneNumber $number a valid phone number for which we want to get a text description
@param string $locale the language code for which the description should be written
@param string $userRegion the region code for a given user. This region will be omitted from the
description if the phone number comes from this region. It is a two-letter uppercase CLDR region
code.
@return string a text description for the given language code for the given phone number, or empty
string if the number passed in is invalid
As per getDescriptionForValidNumber but explicitly checks the validity of the number passed in .