code: private function isActive($route, $params, Request $request)
      {
          if ('/contao' === $request->getPathInfo()
              || !($request->attributes->get('_route') === $route)
          ) {
              return false;
          }
  
          $attributes = $request->attributes->get('_route_params');
          $query      = $request->query;
          foreach ($params as $param => $value) {
              if (isset($attributes[$param]) && ($value !== $request->attributes['_route_params'][$param])) {
                  return false;
              }
              if ($query->has($param) && ($value !== $query->get($param))) {
                  return false;
              }
          }
  
          return true;
      }
docs: Determine if is active.
  
  @param string  $route   The route name.
  @param array   $params  The route parameters.
  @param Request $request The current request.
  
  @return bool