public function RequestContext::fromRequest

File

drupal/core/vendor/symfony/routing/Symfony/Component/Routing/RequestContext.php, line 65

Class

RequestContext
Holds information about the current request.

Namespace

Symfony\Component\Routing

Code

public function fromRequest(Request $request) {
  $this
    ->setBaseUrl($request
    ->getBaseUrl());
  $this
    ->setPathInfo($request
    ->getPathInfo());
  $this
    ->setMethod($request
    ->getMethod());
  $this
    ->setHost($request
    ->getHost());
  $this
    ->setScheme($request
    ->getScheme());
  $this
    ->setHttpPort($request
    ->isSecure() ? $this->httpPort : $request
    ->getPort());
  $this
    ->setHttpsPort($request
    ->isSecure() ? $request
    ->getPort() : $this->httpsPort);
  $this
    ->setQueryString($request->server
    ->get('QUERY_STRING'));
}