getNationalNumberPattern(); // We don't want to consider it a prefix match when matching non-empty input against an empty // pattern if (\strlen($nationalNumberPattern) === 0) { return false; } return $this->match($number, $nationalNumberPattern, $allowPrefixMatch); } /** * @param string $number * @param string $pattern * @param $allowPrefixMatch * @return bool */ private function match($number, $pattern, $allowPrefixMatch) { $matcher = new Matcher($pattern, $number); if (!$matcher->lookingAt()) { return false; } return $matcher->matches() ? true : $allowPrefixMatch; } }