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

Breadcrumb

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

function Response::__toString

Same name in this branch
  1. 11.1.x vendor/symfony/http-foundation/Response.php \Symfony\Component\HttpFoundation\Response::__toString()

Converts the response object to string containing all headers and the response content.

File

vendor/symfony/browser-kit/Response.php, line 41

Class

Response
@author Fabien Potencier <fabien@symfony.com>

Namespace

Symfony\Component\BrowserKit

Code

public function __toString() : string {
    $headers = '';
    foreach ($this->headers as $name => $value) {
        if (\is_string($value)) {
            $headers .= \sprintf("%s: %s\n", $name, $value);
        }
        else {
            foreach ($value as $headerValue) {
                $headers .= \sprintf("%s: %s\n", $name, $headerValue);
            }
        }
    }
    return $headers . "\n" . $this->content;
}

API Navigation

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