W3cubDocs

/Drupal 8

public function TrustedHostsRequestFactory::createRequest

public TrustedHostsRequestFactory::createRequest(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = NULL)

Creates a new request object.

Parameters

array $query: (optional) The query (GET) or request (POST) parameters.

array $request: (optional) An array of request variables.

array $attributes: (optioanl) An array of attributes.

array $cookies: (optional) The request cookies ($_COOKIE).

array $files: (optional) The request files ($_FILES).

array $server: (optional) The server parameters ($_SERVER).

string $content: (optional) The raw body data.

Return value

\Symfony\Component\HttpFoundation\Request A new request object.

File

core/lib/Drupal/Core/Http/TrustedHostsRequestFactory.php, line 60

Class

TrustedHostsRequestFactory
Provides a request factory for requests using host verification.

Namespace

Drupal\Core\Http

Code

public function createRequest(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = NULL) {
  if (empty($server['HTTP_HOST']) || ($server['HTTP_HOST'] === 'localhost' && $this->host !== 'localhost')) {
    $server['HTTP_HOST'] = $this->host;
  }
  return new Request($query, $request, $attributes, $cookies, $files, $server, $content);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Http!TrustedHostsRequestFactory.php/function/TrustedHostsRequestFactory::createRequest/8.1.x