You are here

public function SetCookie::__toString in Lockr 7.3

File

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

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