/** * Create RequestContext from Route. * * @param Route $route * @param array $parameters * @param string $queryString * * @return RequestContext */ public static function createFromRoute(Route $route, array $parameters = array(), $queryString = '') { $path = rtrim(self::computePath($route, $parameters), '/'); $methods = $route->getMethod()->all(); $schema = $route->getSchema()->all(); $request = new RequestContext($path, empty($methods) ? Route::HTTP_METHOD_GET : $methods[0], $queryString); $request->setParameters($parameters); $request->setSchema($schema[0]); if ($route->getDomain()->hasDomain()) { $request->setHost((string) $route->getDomain()); } return $request; }