Builds a new request object based on the given route.

@param Route  $route      Route.
@param string $name       Name of the route.
@param array  $parameters Parameters of the request

@return Request
555351
protected function buildRequest(Route $route, $name = null, array $parameters = array())
    {
        if (null !== $name) {
            $uri = $this->router->generate($name, $parameters);
        } else {
            $uri = $route->getPath();
        }

        return new Request(
            [], // GET
            [], // POST
            [], // Attributes
            [], // Cookies
            [], // Files
            [
                'REQUEST_URI'     => $uri,
                'DOCUMENT_URI'    => $uri,
                'SCRIPT_FILENAME' => realpath($this->kernel->getRootDir().'/../web').$this->baseUrl.'/app.php',
                'SCRIPT_NAME'     => $this->baseUrl.'/app.php'
            ], // Server
            null // Content
        );
    }
337068
public function route($name, $parameters = [])
    {
        $route = router()->route($name);
        if (is_null($route)) {
            throw new \Exception("Route name [$name] not found");
        }

        $route_url = $route->url($parameters);

        return $this->to($route_url);
    }
848223
public function createRoute(Group $group, $name, array $parameters)
	{
		return $this->create('route', array($group, $name, $parameters));
	}
1052594
public function oneNamed(string $name): ?Route
    {
        if (!array_key_exists($name, $this->named)) {
            return null;
        }

        return $this->named[$name];
    }
642115
public function route($name, $path, callable $callback)
    {
        // Modifying path from colon parameters /show/:id to bracket parameters /show/{id}
        $path = preg_replace("|(:(\w+))|", '{$2}', $path);

        // if the route is anonymous
        if (!$name) {
            $name = "N".uniqid();
        }

        $map = $this["router"]->getMap();
        $route = $map->route($name, $path, $callback);

        return $route;
    }
15805
public function attach($name, RouteInterface $route)
    {
        $options = $route->getOptions();
        if (isset($options['method'])) {
            $this->routes[strtoupper($options['method'])][$name] = $route;
        } else {
            $this->routes['*'][$name] = $route;
        }

        return $this;
    }
1249231
public function addResource($name, RestClient $client, $route, $params = [])
    {
        $this->resources[$name] = $this->buildRequest($client, $route, $params);
    }
412032
public function createMenu($name,
        array $defaultRouteParams = array(),
        array $routeParams = array(),
        array $extra = array()
    ) {
        $options = $this->getMenuOptions($name);

        return $this->createMenuFromOptions($options, $defaultRouteParams, $extra);
    }
246717
public function addOnRoute($name, array $routes)
    {
        $route = $this->findRoute($name);

        // if has subroutes, use the that subroutes, else, create a new subroute.
        if($route->hasSubroutes())
            $route->getSubroutes()->addRoutes($routes);
        else
            $route->setSubroutes($routes);

        return $this;
    }
1144388
protected function buildListRoute(Route $route, $name)
    {
        $contentType = $route->getContent();
        $contents    = $this->app['content_repository']->listContents($contentType);

        $this->logger->log(sprintf(
            'Building route <comment>%s</comment> with <info>%s</info> <comment>%s(s)</comment>',
            $name,
            count($contents),
            $contentType
        ));
        $this->builder->build($route, $name);
    }
428558
public function create(ServerRequestInterface $request, Route $route)
    {
        $this->uriGenerator->setRequest($request);
        return new Context($request, $route, $this->uriGenerator);
    }
635793
public function addNamedRoute($name, \Yee\Route $route)
    {
        if ($this->hasNamedRoute($name)) {
            throw new \RuntimeException('Named route already exists with name: ' . $name);
        }
        $this->namedRoutes[(string) $name] = $route;
    }
790651
public function route($name, $parameters = [])
    {
        $path = $this->routes->getPath($name, $parameters);
        $path = ltrim($path, '/');

        return $this->baseUrl.'/'.$path;
    }
1077501
public function linkRoute($route, $name, $parameters=array(), $position="BL", $attributes=array())
    {
        return $this->link(route($route, $parameters), $name, $position, $attributes);
    }
1168524
public function toRoute($name, array $params = [])
    {
        $url = $this->getUrl()->fromRoute($name, $params);

        return $this->toUrl($url);
    }
748529
public function route(string $name, ?array $parameters = [], ?int $code = null)
  {
    $this->url = Route::url($name, $parameters);

    if ($code !== null) {
      $this->code = $code;
      return $this->send();
    }

    return $this;
  }
1330474
private function addRoute($name, array $route)
    {
        extract($this->defaults($route));

        $requirements[RouteCollectionBuilder::K_NAME] = $name;

        $this->builder->addRoute($method, $pattern, $handler, $requirements, $defaults);
    }