libphonenumber\PhoneNumberUtil::checkRegionForParsing PHP Method

checkRegionForParsing() protected method

Returns false if it cannot use the region provided and the region cannot be inferred.
protected checkRegionForParsing ( string $numberToParse, string $defaultRegion ) : boolean
$numberToParse string
$defaultRegion string
return boolean
    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;
    }
PhoneNumberUtil