diff --git a/app/Services/StringMatcher.php b/app/Services/StringMatcher.php index 5565aa3..4ae0fe5 100644 --- a/app/Services/StringMatcher.php +++ b/app/Services/StringMatcher.php @@ -8,10 +8,15 @@ final class StringMatcher { public static function match(string $input, string $pattern, StringMatchMode $mode): bool { - if (empty($input) || empty($pattern)) { + if (blank($input) || blank($pattern)) { return false; } + if ($mode !== StringMatchMode::Regex) { + $input = strtolower($input); + $pattern = strtolower($pattern); + } + return match ($mode) { StringMatchMode::Exact => strcasecmp($input, $pattern) === 0, StringMatchMode::Contains => str_contains($input, $pattern) ,