/** * @param Route $route * @param string $pathUrl * @return Route|null */ protected function matchRule(Route $route, $pathUrl) { $activeRoute = null; $regexp = $this->routeService->makeRegExp($route); if (preg_match('~^' . $regexp . '$~Uiu', $pathUrl, $values)) { $filterValues = array_filter(array_keys($values), 'is_string'); $matches = array_intersect_key($values, array_flip($filterValues)); $activeRoute = $route->setMatches($matches); } return $activeRoute; }