public function generateUniqueRoute(RouteInterface $route, $withSlash = false)
    {
        $originalRoutePattern = $this->generateRouteFromText($route->getRoutePattern(), $withSlash);

        if ($originalRoutePattern) {
            $key = 0;
            $routePattern = $this->normalizeRoute($originalRoutePattern);

            while ($this->hasRoute($routePattern, $route->getName())) {
                $key++;
                $routePattern = $originalRoutePattern . '-' . $key;
            }

            $route->setRoutePattern($routePattern);

            return $route;
        }

        return null;
    }
public function generateUniqueRoute(RouteInterface $route, $withSlash = false)
    {
        $originalRoutePattern = $this->generateRouteFromText($route->getRoutePattern(), $withSlash);

        if ($originalRoutePattern) {
            $key = 0;
            $routePattern = $this->normalizeRoute($originalRoutePattern);

            while ($this->hasRoute($routePattern, $route->getName())) {
                $key++;
                $routePattern = $originalRoutePattern . '-' . $key;
            }

            $route->setRoutePattern($routePattern);

            return $route;
        }

        return null;
    }
public function generateUniqueRoute ( RouteInterface $ route , $ withSlash = false ) { $ originalRoutePattern = $ this -> generateRouteFromText ( $ route -> getRoutePattern ( ) , $ withSlash ) ; if ( $ originalRoutePattern ) { $ key = 0 ; $ routePattern = $ this -> normalizeRoute ( $ originalRoutePattern ) ; while ( $ this -> hasRoute ( $ routePattern , $ route -> getName ( ) ) ) { $ key ++ ; $ routePattern = $ originalRoutePattern . '-' . $ key ; } $ route -> setRoutePattern ( $ routePattern ) ; return $ route ; } return null ; }
Generate unique route.

@param RouteInterface $route
@param bool $withSlash

@return null|RouteInterface
Generate unique route .