public function filterMatch($patterns)
{
$patterns = is_string($patterns) ? [$patterns] : $patterns;
// String pattern is assumed to be path.
foreach ($patterns as $key => $pattern) {
if (is_string($pattern)) {
$patterns[$key] = ['path' => $pattern];
}
}
return $this->filter(function ($route) use($patterns) {
// If any of patterns matches - route passes.
foreach ($patterns as $pattern) {
if ($this->isRouteMatchesPattern($route, $pattern)) {
return true;
}
}
// If all patterns don't match - route is filtered out.
return false;
});
}