Get a route path by a given name
@param string $routeName
@param array $params (optional)
@return string
540857
final public function urlFor($routeName, array $params = array())
    {
        if (null === $this->router) {
            return '';
        }

        return $this->router->urlFor($routeName, $params);
    }
153032
public function routeParams($params = '')
    {
        if (!empty($params)) {
            // Set the property
            if (is_a($params, 'stdClass')) {
                $this->routeParams = $params;
            } else {
                return false;
            }
        } else {
            // Get the property
            return $this->routeParams;
        }
    }
1137371
public function seeCurrentRouteIs($routeName, array $params = [])
    {
        $router = $this->client->grabServiceFromContainer('router');
        $url = $router->assemble($params, ['name' => $routeName]);
        $this->seeCurrentUrlEquals($url);
    }
1369281
protected function getPathParams(array $params = []): string
    {
        if (empty($params)) {
            return '';
        }
        $path = $params['path'] ?? [];
        if (is_string($path)) {
            return $path;
        }
        $path = collect($path)->map(function ($entry) {
            return (string) $entry;
        })->all();
        return implode('/', $path);
    }
893804
public function findOneByRoute($routeName)
    {
        $qb = $this->getQueryBuilder('p');

        return $qb
            ->leftJoin('p.seo', 's')
            ->leftJoin('s.translations', 's_t', Expr\Join::WITH, $this->getLocaleCondition('s_t'))
            ->addSelect('s', 's_t')
            ->andWhere($qb->expr()->eq('p.route', ':route_name'))
            ->getQuery()
            ->setParameter('route_name', $routeName)
            ->useQueryCache(true)
            // TODO ->useResultCache(true, 3600, 'ekyna_cms.page[route:' . $routeName . ']')
            ->getOneOrNullResult();
    }
225823
public function amOnRoute($routeName, array $params = [])
    {
        if (!$this->di->has('url')) {
            $this->fail('Unable to resolve "url" service.');
        }

        /** @var Url $url */
        $url = $this->di->getShared('url');

        $urlParams = ['for' => $routeName];

        if ($params) {
            $urlParams += $params;
        }

        $this->amOnPage($url->get($urlParams, null, true));
    }
1335892
protected function path($route, array $params = [], array $queryParams = [])
    {
        return $this->container['router']->pathFor($route, $params, $queryParams);
    }
1048267
public function amOnRoute($routeName, $params = [])
    {
        $route = $this->getRouteByName($routeName);

        if (!$route) {
            $this->fail("Could not find route with name '$routeName'");
        }

        $url = $this->generateUrlForRoute($route, $params);
        $this->amOnPage($url);
    }
181891
public function amOnRoute($routeName, array $params = [])
    {
        $router = $this->grabService('router');
        if (!$router->getRouteCollection()->get($routeName)) {
            $this->fail(sprintf('Route with name "%s" does not exists.', $routeName));
        }
        $url = $router->generate($routeName, $params);
        $this->amOnPage($url);
    }
561906
protected function findRouteRecursively($routeName)
    {
        // alias check
        if(is_string($routeName)) {
            if(isset($this->aliasIndices[$routeName])) {
                $routeName = $this->aliasIndices[$routeName];
            } else {
                foreach($this->groupAliasIndices as $alias => $name) {
                    if(strpos($routeName, $alias) === 0) {
                        $routeName = substr_replace($routeName, $name, 0, strlen($alias));
                        break;
                    }
                }
            }
        }

        $routeNames = !is_array($routeName) ? explode('.', $routeName) : $routeName;
        $routeName = array_shift($routeNames);
        $isTag = strpos($routeName, '#') === 0;

        // search by route name
        if(!$isTag)
        {
            // loop this group, and find the route.
            foreach($this->storage as $route)
            {
                if($route->getName() === $routeName)
                {
                    // still has depth
                    if(count($routeNames) > 0)
                        if($route->hasSubroutes())
                            return $route->getSubroutes()->findRouteRecursively($routeNames);
                        else
                            return false;

                    return $route;
                }
            }
        }
        // search by route tag under this group.
        else
        {
            $route = $this->findRouteByTag(substr($routeName, 1));

            if($route)
            {
                if(count($routeNames) > 0)
                    if($route->hasSubroutes())
                        return $route->getSubroutes()->findRouteRecursively($routeNames);
                    else
                        return false;

                return $route;
            }
        }

        return false;
    }
320213
public function findRoute($routeName)
    {
        // TODO create a route finder ? (same in CmsBundle BreadcrumbBuilder)
        $i18nRouterClass = 'JMS\I18nRoutingBundle\Router\I18nRouterInterface';
        if (interface_exists($i18nRouterClass) && $this->router instanceof $i18nRouterClass) {
            $route = $this->router->getOriginalRouteCollection()->get($routeName);
        } else {
            $route = $this->router->getRouteCollection()->get($routeName);
        }
        if (null === $route) {
            throw new \RuntimeException(sprintf('Route "%s" not found.', $routeName));
        }
        return $route;
    }
441990
public function url($params) {
        $uri = isset($params['uri']) ? $params['uri'] : '';
        $named_params = isset($params['params']) ? $params['params'] : array();
        if ($named_uri = Router::get($uri, $named_params)) {
            $uri = $named_uri;
        }
        return Uri::create($uri);
    }
614454
public function redirectToRoute($routeName, array $parameters = [])
    {
        $url = $this->router->getRouteUrlByName($routeName, $parameters);
        if (!$url) {
            throw new \Parable\Framework\Exception("Can't redirect to route, '{$routeName}' does not exist.");
        }
        $this->response->redirect($this->url->getUrl($url));
    }
488041
public function computePath($params) {
    $route = $this->getPath();

    if (!preg_match_all(
      '~' . self::VARIABLE_REGEX . '~x', $route, $matches,
      PREG_OFFSET_CAPTURE | PREG_SET_ORDER
    )) {
      return $route;
    }

    $offset = 0;
    $url = '';

    /** @var string[] $matches */
    foreach ($matches as $set) {
      if ($set[0][1] > $offset) {
        $url .= substr($route, $offset, $set[0][1] - $offset);
      }
      if(isset($params[$set[1][0]])) {
        $url .= $params[$set[1][0]];
      } else {
        throw new \InvalidArgumentException(sprintf('No value supplied for "%s"', $set[1][0]));
      }
      $offset = $set[0][1] + strlen($set[0][0]);
    }
    if ($offset !== strlen($route)) {
      $url .= substr($route, $offset);
    }

    return $url;
  }
1190260
public function url(string $name, array $params = []): string
    {
        return $this->core->router->generate($name, $params);
    }
279598
public function getRoute(string $name = null, ...$args)
    {
        if (is_null($name)) {
            return $this->get('route');
        }

        return $this->get('route', $name, ...$args);
    }
1275849
protected function buildUrl(string $pathName, array $params = []): string
    {
        $uri = new BasicUri($this->baseUrl.$this->token.$pathName);
        foreach ($params as $name => $value) {
            if (is_bool($value)) {
                $value = (int)$value;
            }
            $uri = $uri->withQueryValue($name, $value);
        }

        return (string) $uri;
    }