You are here

public function RequestContext::fromRequest in Zircon Profile 8

Same name in this branch
  1. 8 vendor/symfony/routing/RequestContext.php \Symfony\Component\Routing\RequestContext::fromRequest()
  2. 8 core/lib/Drupal/Core/Routing/RequestContext.php \Drupal\Core\Routing\RequestContext::fromRequest()
Same name and namespace in other branches
  1. 8.0 vendor/symfony/routing/RequestContext.php \Symfony\Component\Routing\RequestContext::fromRequest()

Updates the RequestContext information based on a HttpFoundation Request.

Parameters

Request $request A Request instance:

Return value

RequestContext The current instance, implementing a fluent interface

1 call to RequestContext::fromRequest()
RequestContext::fromRequest in core/lib/Drupal/Core/Routing/RequestContext.php
Updates the RequestContext information based on a HttpFoundation Request.
1 method overrides RequestContext::fromRequest()
RequestContext::fromRequest in core/lib/Drupal/Core/Routing/RequestContext.php
Updates the RequestContext information based on a HttpFoundation Request.

File

vendor/symfony/routing/RequestContext.php, line 71

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', ''));
  return $this;
}