Http/Cookie.php
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Http
- Subpackage
- Cookie
- Version
- $Id$
\Zend_Http_Cookie
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties
Methods

__construct(string $name, string $value, string $domain, int $expires = null, string $path = null, bool $secure = false) : voidCookie object constructor
| Name | Type | Description |
|---|---|---|
| $name | string | |
| $value | string | |
| $domain | string | |
| $expires | int | |
| $path | string | |
| $secure | bool |
- Todo
- Add validation of each one of the parameters (legal domain, etc.)

__toString() : stringGet the cookie as a string, suitable for sending as a "Cookie" header in an HTTP request
| Type | Description |
|---|---|
| string |

fromString(string $cookieStr, \Zend_Uri_Http | string $refUri = null, boolean $encodeValue = true) : \Zend_Http_CookieGenerate a new Cookie object from a cookie string (for example the value of the Set-Cookie HTTP header)
| Name | Type | Description |
|---|---|---|
| $cookieStr | string | |
| $refUri | \Zend_Uri_Http | string | Reference URI for default values (domain, path) |
| $encodeValue | boolean | Whether or not the cookie's value should be |
| Type | Description |
|---|---|
| \Zend_Http_Cookie | A new Zend_Http_Cookie object or false on failure. |

getExpiryTime() : int | nullGet the expiry time of the cookie, or null if no expiry time is set
| Type | Description |
|---|---|
| int | null |

isExpired(int $now = null) : booleanCheck whether the cookie has expired
| Name | Type | Description |
|---|---|---|
| $now | int | Timestamp to consider as "now" |
| Type | Description |
|---|---|
| boolean |

isSecure() : booleanCheck whether the cookie should only be sent over secure connections
| Type | Description |
|---|---|
| boolean |

isSessionCookie() : booleanCheck whether the cookie is a session cookie (has no expiry time set)
| Type | Description |
|---|---|
| boolean |

match(string | \Zend_Uri_Http $uri, boolean $matchSessionCookies = true, int $now = null) : booleanChecks whether the cookie should be sent or not in a specific scenario
| Name | Type | Description |
|---|---|---|
| $uri | string | \Zend_Uri_Http | URI to check against (secure, domain, path) |
| $matchSessionCookies | boolean | Whether to send session cookies |
| $now | int | Override the current time when checking for expiry time |
| Type | Description |
|---|---|
| boolean |

matchCookieDomain(string $cookieDomain, string $host) : booleanCheck if a cookie's domain matches a host name.
| Name | Type | Description |
|---|---|---|
| $cookieDomain | string | |
| $host | string |
| Type | Description |
|---|---|
| boolean |