Microsoft_Http
[ class tree: Microsoft_Http ] [ index: Microsoft_Http ] [ all elements ]

Class: Microsoft_Http_Cookie

Source Location: /Http/Cookie.php

Class Overview


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


Author(s):

Copyright:

  • Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)

Variables

Methods



Class Details

[line 47]
Microsoft_Http_Cookie is a class describing an HTTP cookie and all it's parameters.

Microsoft_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.




Tags:

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


[ Top ]


Class Variables

$domain =

[line 75]

Cookie domain



Tags:

access:  protected

Type:   string


[ Top ]

$expires =

[line 68]

Cookie expiry date



Tags:

access:  protected

Type:   int


[ Top ]

$name =

[line 54]

Cookie name



Tags:

access:  protected

Type:   string


[ Top ]

$path =

[line 82]

Cookie path



Tags:

access:  protected

Type:   string


[ Top ]

$secure =

[line 89]

Whether the cookie is secure or not



Tags:

access:  protected

Type:   boolean


[ Top ]

$value =

[line 61]

Cookie value



Tags:

access:  protected

Type:   string


[ Top ]



Class Methods


static method fromString [line 272]

static Microsoft_Http_Cookie fromString( string $cookieStr, [Microsoft_Uri_Http|string $ref_uri = null])

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



Tags:

return:  A new Microsoft_Http_Cookie object or false on failure.
access:  public


Parameters:

string   $cookieStr  
Microsoft_Uri_Http|string   $ref_uri   Reference URI for default values (domain, path)

[ Top ]

static method matchCookieDomain [line 361]

static boolean matchCookieDomain( string $cookieDomain, string $host)

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

Used by Microsoft_Http_Cookie and Microsoft_Http_CookieJar for cookie matching




Tags:

access:  public


Parameters:

string   $cookieDomain  
string   $host  

[ Top ]

static method matchCookiePath [line 394]

static boolean matchCookiePath( string $cookiePath, string $path)

Check if a cookie's path matches a URL path

Used by Microsoft_Http_Cookie and Microsoft_Http_CookieJar for cookie matching




Tags:

access:  public


Parameters:

string   $cookiePath  
string   $path  

[ Top ]

constructor __construct [line 103]

Microsoft_Http_Cookie __construct( string $name, string $value, string $domain, [int $expires = null], [string $path = null], [bool $secure = false])

Cookie object constructor



Tags:

todo:  Add validation of each one of the parameters (legal domain, etc.)
access:  public


Parameters:

string   $name  
string   $value  
string   $domain  
int   $expires  
string   $path  
bool   $secure  

[ Top ]

method getDomain [line 151]

string getDomain( )

Get cookie domain



Tags:

access:  public


[ Top ]

method getExpiryTime [line 171]

int|null getExpiryTime( )

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



Tags:

access:  public


[ Top ]

method getName [line 131]

string getName( )

Get Cookie name



Tags:

access:  public


[ Top ]

method getPath [line 161]

string getPath( )

Get the cookie path



Tags:

access:  public


[ Top ]

method getValue [line 141]

string getValue( )

Get cookie value



Tags:

access:  public


[ Top ]

method isExpired [line 194]

boolean isExpired( [int $now = null])

Check whether the cookie has expired

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




Tags:

access:  public


Parameters:

int   $now   Timestamp to consider as "now"

[ Top ]

method isSecure [line 181]

boolean isSecure( )

Check whether the cookie should only be sent over secure connections



Tags:

access:  public


[ Top ]

method isSessionCookie [line 209]

boolean isSessionCookie( )

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



Tags:

access:  public


[ Top ]

method match [line 222]

boolean match( string|Microsoft_Uri_Http $uri, [boolean $matchSessionCookies = true], [int $now = null])

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



Tags:

access:  public


Parameters:

string|Microsoft_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

[ Top ]

method __toString [line 259]

string __toString( )

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



Tags:

access:  public


[ Top ]


Documentation generated on Wed, 18 May 2011 12:06:26 +0200 by phpDocumentor 1.4.3