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

Breadcrumb

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

function SetCookie::__toString

File

vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php, line 135

Class

SetCookie
Set-Cookie object

Namespace

GuzzleHttp\Cookie

Code

public function __toString() {
    $str = $this->data['Name'] . '=' . ($this->data['Value'] ?? '') . '; ';
    foreach ($this->data as $k => $v) {
        if ($k !== 'Name' && $k !== 'Value' && $v !== null && $v !== false) {
            if ($k === 'Expires') {
                $str .= 'Expires=' . \gmdate('D, d M Y H:i:s \\G\\M\\T', $v) . '; ';
            }
            else {
                $str .= ($v === true ? $k : "{$k}={$v}") . '; ';
            }
        }
    }
    return \rtrim($str, '; ');
}

API Navigation

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