src/PhoneNumberUtil.php
protected function rawInputContainsNationalPrefix($rawInput, $nationalPrefix, $regionCode)
    {
        $normalizedNationalNumber = static::normalizeDigitsOnly($rawInput);
        if (strpos($normalizedNationalNumber, $nationalPrefix) === 0) {
            try {
                // Some Japanese numbers (e.g. 00777123) might be mistaken to contain the national prefix
                // when written without it (e.g. 0777123) if we just do prefix matching. To tackle that, we
                // check the validity of the number if the assumed national prefix is removed (777123 won't
                // be valid in Japan).
                return $this->isValidNumber(
                    $this->parse(substr($normalizedNationalNumber, mb_strlen($nationalPrefix)), $regionCode)
                );
            } catch (NumberParseException $e) {
                return false;
            }
        }
        return false;
    }
protected function rawInputContainsNationalPrefix($rawInput, $nationalPrefix, $regionCode)
    {
        $normalizedNationalNumber = static::normalizeDigitsOnly($rawInput);
        if (strpos($normalizedNationalNumber, $nationalPrefix) === 0) {
            try {
                // Some Japanese numbers (e.g. 00777123) might be mistaken to contain the national prefix
                // when written without it (e.g. 0777123) if we just do prefix matching. To tackle that, we
                // check the validity of the number if the assumed national prefix is removed (777123 won't
                // be valid in Japan).
                return $this->isValidNumber(
                    $this->parse(substr($normalizedNationalNumber, mb_strlen($nationalPrefix)), $regionCode)
                );
            } catch (NumberParseException $e) {
                return false;
            }
        }
        return false;
    }
protected function rawInputContainsNationalPrefix ( $ rawInput , $ nationalPrefix , $ regionCode ) { $ normalizedNationalNumber = static :: normalizeDigitsOnly ( $ rawInput ) ; if ( strpos ( $ normalizedNationalNumber , $ nationalPrefix ) === 0 ) { try { // Some Japanese numbers (e.g. 00777123) might be mistaken to contain the national prefix // when written without it (e.g. 0777123) if we just do prefix matching. To tackle that, we // check the validity of the number if the assumed national prefix is removed (777123 won't // be valid in Japan). return $ this -> isValidNumber ( $ this -> parse ( substr ( $ normalizedNationalNumber , mb_strlen ( $ nationalPrefix ) ) , $ regionCode ) ) ; } catch ( NumberParseException $ e ) { return false ; } } return false ; }
Check if rawInput, which is assumed to be in the national format, has a national prefix. The
national prefix is assumed to be in digits-only form.
@param string $rawInput
@param string $nationalPrefix
@param string $regionCode
@return bool
Check if rawInput which is assumed to be in the national format has a national prefix . The national prefix is assumed to be in digits - only form .