src/PhoneNumberUtil.php
protected function checkRegionForParsing($numberToParse, $defaultRegion)
    {
        if (!$this->isValidRegionCode($defaultRegion)) {
            // If the number is null or empty, we can't infer the region.
            $plusCharsPatternMatcher = new Matcher(static::$PLUS_CHARS_PATTERN, $numberToParse);
            if ($numberToParse === null || mb_strlen($numberToParse) == 0 || !$plusCharsPatternMatcher->lookingAt()) {
                return false;
            }
        }
        return true;
    }
protected function checkRegionForParsing($numberToParse, $defaultRegion)
    {
        if (!$this->isValidRegionCode($defaultRegion)) {
            // If the number is null or empty, we can't infer the region.
            $plusCharsPatternMatcher = new Matcher(static::$PLUS_CHARS_PATTERN, $numberToParse);
            if ($numberToParse === null || mb_strlen($numberToParse) == 0 || !$plusCharsPatternMatcher->lookingAt()) {
                return false;
            }
        }
        return true;
    }
protected function checkRegionForParsing ( $ numberToParse , $ defaultRegion ) { if ( ! $ this -> isValidRegionCode ( $ defaultRegion ) ) { // If the number is null or empty, we can't infer the region. $ plusCharsPatternMatcher = new Matcher ( static :: $ PLUS_CHARS_PATTERN , $ numberToParse ) ; if ( $ numberToParse === null || mb_strlen ( $ numberToParse ) == 0 || ! $ plusCharsPatternMatcher -> lookingAt ( ) ) { return false ; } } return true ; }
Checks to see that the region code used is valid, or if it is not valid, that the number to
parse starts with a + symbol so that we can attempt to infer the region from the number.
Returns false if it cannot use the region provided and the region cannot be inferred.
@param string $numberToParse
@param string $defaultRegion
@return bool
Checks to see that the region code used is valid or if it is not valid that the number to parse starts with a + symbol so that we can attempt to infer the region from the number . Returns false if it cannot use the region provided and the region cannot be inferred .