You are here

public function ResponseHeaderBag::__toString in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/ResponseHeaderBag.php \Symfony\Component\HttpFoundation\ResponseHeaderBag::__toString()

Returns the headers as a string.

Return value

string The headers

Overrides HeaderBag::__toString

File

vendor/symfony/http-foundation/ResponseHeaderBag.php, line 59

Class

ResponseHeaderBag
ResponseHeaderBag is a container for Response HTTP headers.

Namespace

Symfony\Component\HttpFoundation

Code

public function __toString() {
  $cookies = '';
  foreach ($this
    ->getCookies() as $cookie) {
    $cookies .= 'Set-Cookie: ' . $cookie . "\r\n";
  }
  ksort($this->headerNames);
  return parent::__toString() . $cookies;
}