src/PhoneNumberUtil.php
public function getNumberType(PhoneNumber $number)
    {
        $regionCode = $this->getRegionCodeForNumber($number);
        $metadata = $this->getMetadataForRegionOrCallingCode($number->getCountryCode(), $regionCode);
        if ($metadata === null) {
            return PhoneNumberType::UNKNOWN;
        }
        $nationalSignificantNumber = $this->getNationalSignificantNumber($number);
        return $this->getNumberTypeHelper($nationalSignificantNumber, $metadata);
    }
public function getNumberType(PhoneNumber $number)
    {
        $regionCode = $this->getRegionCodeForNumber($number);
        $metadata = $this->getMetadataForRegionOrCallingCode($number->getCountryCode(), $regionCode);
        if ($metadata === null) {
            return PhoneNumberType::UNKNOWN;
        }
        $nationalSignificantNumber = $this->getNationalSignificantNumber($number);
        return $this->getNumberTypeHelper($nationalSignificantNumber, $metadata);
    }
public function getNumberType ( PhoneNumber $ number ) { $ regionCode = $ this -> getRegionCodeForNumber ( $ number ) ; $ metadata = $ this -> getMetadataForRegionOrCallingCode ( $ number -> getCountryCode ( ) , $ regionCode ) ; if ( $ metadata === null ) { return PhoneNumberType :: UNKNOWN ; } $ nationalSignificantNumber = $ this -> getNationalSignificantNumber ( $ number ) ; return $ this -> getNumberTypeHelper ( $ nationalSignificantNumber , $ metadata ) ; }
Gets the type of a valid phone number.
@param PhoneNumber $number the number the phone number that we want to know the type
@return int PhoneNumberType the type of the phone number, or UNKNOWN if it is invalid
Gets the type of a valid phone number .