Class Zend_Http_Cookie

Description

Zend_Http_Cookie is a class describing an HTTP cookie and all it's parameters.

Zend_Http_Cookie is a class describing an HTTP cookie and all it's parameters. The class also enables validating whether the cookie should be sent to the server in a specified scenario according to the request URI, the expiry time and whether session cookies should be used or not. Generally speaking cookies should be contained in a Cookiejar object, or instantiated manually and added to an HTTP request.

See http://wp.netscape.com/newsref/std/cookie_spec.html for some specs.

  • copyright: Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  • license: New BSD License

Located in /Http/Cookie.php (line 47)


	
			
Variable Summary
 string $domain
 boolean $encodeValue
 int $expires
 string $name
 string $path
 boolean $secure
 string $value
Method Summary
 static Zend_Http_Cookie fromString (string $cookieStr, [Zend_Uri_Http|string $refUri = null], [boolean $encodeValue = true])
 static boolean matchCookieDomain (string $cookieDomain, string $host)
 static boolean matchCookiePath (string $cookiePath, string $path)
 Zend_Http_Cookie __construct (string $name, string $value, string $domain, [int $expires = null], [string $path = null], [bool $secure = false])
 string getDomain ()
 int|null getExpiryTime ()
 string getName ()
 string getPath ()
 string getValue ()
 boolean isExpired ([int $now = null])
 boolean isSecure ()
 boolean isSessionCookie ()
 boolean match (string|Zend_Uri_Http $uri, [boolean $matchSessionCookies = true], [int $now = null])
 string __toString ()
Variables
string $domain (line 75)

Cookie domain

  • access: protected
boolean $encodeValue (line 96)

Whether the cookie value has been encoded/decoded

  • access: protected
int $expires (line 68)

Cookie expiry date

  • access: protected
string $name (line 54)

Cookie name

  • access: protected
string $path (line 82)

Cookie path

  • access: protected
boolean $secure (line 89)

Whether the cookie is secure or not

  • access: protected
string $value (line 61)

Cookie value

  • access: protected
Methods
static fromString (line 284)

Generate a new Cookie object from a cookie string (for example the value of the Set-Cookie HTTP header)

  • return: A new Zend_Http_Cookie object or false on failure.
  • access: public
static Zend_Http_Cookie fromString (string $cookieStr, [Zend_Uri_Http|string $refUri = null], [boolean $encodeValue = true])
  • string $cookieStr
  • Zend_Uri_Http|string $refUri: Reference URI for default values (domain, path)
  • boolean $encodeValue: Weither or not the cookie's value should be passed through urlencode/urldecode
static matchCookieDomain (line 377)

Check if a cookie's domain matches a host name.

Used by Zend_Http_Cookie and Zend_Http_CookieJar for cookie matching

  • access: public
static boolean matchCookieDomain (string $cookieDomain, string $host)
  • string $cookieDomain
  • string $host
static matchCookiePath (line 410)

Check if a cookie's path matches a URL path

Used by Zend_Http_Cookie and Zend_Http_CookieJar for cookie matching

  • access: public
static boolean matchCookiePath (string $cookiePath, string $path)
  • string $cookiePath
  • string $path
Constructor __construct (line 110)

Cookie object constructor

  • todo: Add validation of each one of the parameters (legal domain, etc.)
  • access: public
Zend_Http_Cookie __construct (string $name, string $value, string $domain, [int $expires = null], [string $path = null], [bool $secure = false])
  • string $name
  • string $value
  • string $domain
  • int $expires
  • string $path
  • bool $secure
getDomain (line 158)

Get cookie domain

  • access: public
string getDomain ()
getExpiryTime (line 178)

Get the expiry time of the cookie, or null if no expiry time is set

  • access: public
int|null getExpiryTime ()
getName (line 138)

Get Cookie name

  • access: public
string getName ()
getPath (line 168)

Get the cookie path

  • access: public
string getPath ()
getValue (line 148)

Get cookie value

  • access: public
string getValue ()
isExpired (line 201)

Check whether the cookie has expired

Always returns false if the cookie is a session cookie (has no expiry time)

  • access: public
boolean isExpired ([int $now = null])
  • int $now: Timestamp to consider as "now"
isSecure (line 188)

Check whether the cookie should only be sent over secure connections

  • access: public
boolean isSecure ()
isSessionCookie (line 216)

Check whether the cookie is a session cookie (has no expiry time set)

  • access: public
boolean isSessionCookie ()
match (line 229)

Checks whether the cookie should be sent or not in a specific scenario

  • access: public
boolean match (string|Zend_Uri_Http $uri, [boolean $matchSessionCookies = true], [int $now = null])
  • string|Zend_Uri_Http $uri: URI to check against (secure, domain, path)
  • boolean $matchSessionCookies: Whether to send session cookies
  • int $now: Override the current time when checking for expiry time
__toString (line 266)

Get the cookie as a string, suitable for sending as a "Cookie" header in an HTTP request

  • access: public
string __toString ()

Documentation generated on Mon, 21 Jun 2010 15:14:21 -0400 by phpDocumentor 1.4.3