src/PhoneNumberUtil.php
protected function parsePrefixAsIdd($iddPattern, &$number)
    {
        $m = new Matcher($iddPattern, $number);
        if ($m->lookingAt()) {
            $matchEnd = $m->end();
            // Only strip this if the first digit after the match is not a 0, since country calling codes
            // cannot begin with 0.
            $digitMatcher = new Matcher(static::$CAPTURING_DIGIT_PATTERN, substr($number, $matchEnd));
            if ($digitMatcher->find()) {
                $normalizedGroup = static::normalizeDigitsOnly($digitMatcher->group(1));
                if ($normalizedGroup == '0') {
                    return false;
                }
            }
            $number = substr($number, $matchEnd);
            return true;
        }
        return false;
    }
protected function parsePrefixAsIdd($iddPattern, &$number)
    {
        $m = new Matcher($iddPattern, $number);
        if ($m->lookingAt()) {
            $matchEnd = $m->end();
            // Only strip this if the first digit after the match is not a 0, since country calling codes
            // cannot begin with 0.
            $digitMatcher = new Matcher(static::$CAPTURING_DIGIT_PATTERN, substr($number, $matchEnd));
            if ($digitMatcher->find()) {
                $normalizedGroup = static::normalizeDigitsOnly($digitMatcher->group(1));
                if ($normalizedGroup == '0') {
                    return false;
                }
            }
            $number = substr($number, $matchEnd);
            return true;
        }
        return false;
    }
protected function parsePrefixAsIdd ( $ iddPattern , & $ number ) { $ m = new Matcher ( $ iddPattern , $ number ) ; if ( $ m -> lookingAt ( ) ) { $ matchEnd = $ m -> end ( ) ; // Only strip this if the first digit after the match is not a 0, since country calling codes // cannot begin with 0. $ digitMatcher = new Matcher ( static :: $ CAPTURING_DIGIT_PATTERN , substr ( $ number , $ matchEnd ) ) ; if ( $ digitMatcher -> find ( ) ) { $ normalizedGroup = static :: normalizeDigitsOnly ( $ digitMatcher -> group ( 1 ) ) ; if ( $ normalizedGroup == '0' ) { return false ; } } $ number = substr ( $ number , $ matchEnd ) ; return true ; } return false ; }
Strips the IDD from the start of the number if present. Helper function used by
maybeStripInternationalPrefixAndNormalize.
@param string $iddPattern
@param string $number
@return bool
Strips the IDD from the start of the number if present . Helper function used by maybeStripInternationalPrefixAndNormalize .