You are here

public function SetCookie::__toString in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php \GuzzleHttp\Cookie\SetCookie::__toString()

File

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

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, '; ');
}