public function Cookie::__toString in Zircon Profile 8
Same name in this branch
- 8 vendor/symfony/http-foundation/Cookie.php \Symfony\Component\HttpFoundation\Cookie::__toString()
- 8 vendor/symfony/browser-kit/Cookie.php \Symfony\Component\BrowserKit\Cookie::__toString()
Same name and namespace in other branches
- 8.0 vendor/symfony/http-foundation/Cookie.php \Symfony\Component\HttpFoundation\Cookie::__toString()
Returns the cookie as a string.
Return value
string The cookie
File
- vendor/
symfony/ http-foundation/ Cookie.php, line 78
Class
- Cookie
- Represents a cookie.
Namespace
Symfony\Component\HttpFoundationCode
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 ($this
->getDomain()) {
$str .= '; domain=' . $this
->getDomain();
}
if (true === $this
->isSecure()) {
$str .= '; secure';
}
if (true === $this
->isHttpOnly()) {
$str .= '; httponly';
}
return $str;
}