/**
* Helper method to check a number against a particular pattern and determine whether it matches,
* or is too short or too long. Currently, if a number pattern suggests that numbers of length 7
* and 10 are possible, and a number in between these possible lengths is entered, such as of
* length 8, this will return TOO_LONG.
*/
private function testNumberLengthAgainstPattern($numberPattern, $number)
{
$numberMatcher = new Matcher($numberPattern, $number);
if ($numberMatcher->matches()) {
return ValidationResult::IS_POSSIBLE;
}
if ($numberMatcher->lookingAt()) {
return ValidationResult::TOO_LONG;
} else {
return ValidationResult::TOO_SHORT;
}
}