Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Request.php

function Request::__toString

File

vendor/symfony/http-foundation/Request.php, line 471

Class

Request
Request represents an HTTP request.

Namespace

Symfony\Component\HttpFoundation

Code

public function __toString() : string {
    $content = $this->getContent();
    $cookieHeader = '';
    $cookies = [];
    foreach ($this->cookies as $k => $v) {
        $cookies[] = \is_array($v) ? http_build_query([
            $k => $v,
        ], '', '; ', \PHP_QUERY_RFC3986) : "{$k}={$v}";
    }
    if ($cookies) {
        $cookieHeader = 'Cookie: ' . implode('; ', $cookies) . "\r\n";
    }
    return \sprintf('%s %s %s', $this->getMethod(), $this->getRequestUri(), $this->server
        ->get('SERVER_PROTOCOL')) . "\r\n" . $this->headers . $cookieHeader . "\r\n" . $content;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal