Returns the cookie as a string.
string The cookie
public function __toString() {
$str = urlencode($this
->getName()) . '=';
if ('' === (string) $this
->getValue()) {
$str .= 'deleted; expires=' . gmdate("D, d-M-Y H:i:s T", time() - 31536001);
}
else {
$str .= urlencode($this
->getValue());
if ($this
->getExpiresTime() !== 0) {
$str .= '; expires=' . gmdate("D, d-M-Y H:i:s T", $this
->getExpiresTime());
}
}
if ('/' !== $this->path) {
$str .= '; path=' . $this->path;
}
if (null !== $this
->getDomain()) {
$str .= '; domain=' . $this
->getDomain();
}
if (true === $this
->isSecure()) {
$str .= '; secure';
}
if (true === $this
->isHttpOnly()) {
$str .= '; httponly';
}
return $str;
}