Http/Header/SetCookie.php

Show: inherited
Table of Contents

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Http  
Subpackage
Header  
Version
$Id$  

\Zend_Http_Header_SetCookie

Package: Zend\Http\Header

Zend_Http_Client is an implementation of an HTTP client in PHP.

The client supports basic features like sending different HTTP requests and handling redirections, as well as more advanced features like proxy settings, HTTP authentication and cookie persistence (using a Zend_Http_CookieJar object)

Category
Zend  
Copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Todo
Implement proxy settings  

Properties

Propertyprotectedstring $domain = null

Cookie domain

Default valuenullDetails
Type
string
Propertyprotectedint $expires = null

Cookie expiry date

Default valuenullDetails
Type
int
Propertyprotectedtrue $httponly = null

Default valuenullDetails
Type
true
Propertyprotectedinteger $maxAge = null

Max Age

Default valuenullDetails
Type
integer
Propertyprotectedstring $name = null

Cookie name

Default valuenullDetails
Type
string
Propertyprotectedstring $path = null

Cookie path

Default valuenullDetails
Type
string
Propertyprotectedboolean $secure = null

Whether the cookie is secure or not

Default valuenullDetails
Type
boolean
Propertyprotectedstring $value = null

Cookie value

Default valuenullDetails
Type
string
Propertyprotectedinteger $version = null

Version

Default valuenullDetails
Type
integer

Methods

methodpublic__construct(string $name = null, string $value = null, int $expires = null, string $path = null, string $domain = null, bool $secure = false, bool $httponly = false, string $maxAge = null, int $version = null) : \SetCookie

Cookie object constructor

Parameters
Name Type Description
$name string
$value string
$expires int
$path string
$domain string
$secure bool
$httponly bool
$maxAge string
$version int
Returns
Type Description
\SetCookie
Details
Todo
Add validation of each one of the parameters (legal domain, etc.)  
methodpublic__toString() : void

methodpublicfromString( $headerLine, bool $bypassHeaderFieldName = false) : array | \SetCookie
static

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

Parameters
Name Type Description
$headerLine
$bypassHeaderFieldName bool
Returns
Type Description
array | \SetCookie
Throws
Exception Description
\Zend_Http_Header_Exception_InvalidArgumentException
Details
Static
 
methodpublicgetDomain() : string

Returns
Type Description
string
methodpublicgetExpires( $inSeconds = false) : int

Parameters
Name Type Description
$inSeconds
Returns
Type Description
int
methodpublicgetFieldName() : string

Returns
Type Description
string 'Set-Cookie'
methodpublicgetFieldValue() : string

Returns
Type Description
string
Throws
Exception Description
\Zend_Http_Header_Exception_RuntimeException
methodpublicgetMaxAge() : integer

Get Max-Age

Returns
Type Description
integer
methodpublicgetName() : string

Returns
Type Description
string
methodpublicgetPath() : string

Returns
Type Description
string
methodpublicgetValue() : string

Returns
Type Description
string
methodpublicgetVersion() : integer

Get version

Returns
Type Description
integer
methodpublicisExpired(int $now = null) : boolean

Check whether the cookie has expired

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

Parameters
Name Type Description
$now int

Timestamp to consider as "now"

Returns
Type Description
boolean
methodpublicisHttponly() : bool

Returns
Type Description
bool
methodpublicisSecure() : boolean

Returns
Type Description
boolean
methodpublicisSessionCookie() : boolean

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

Returns
Type Description
boolean
methodpublicisValidForRequest( $requestDomain,  $path,  $isSecure = false) : void

Parameters
Name Type Description
$requestDomain
$path
$isSecure
methodpublicsetDomain(string $domain) : void

Parameters
Name Type Description
$domain string
methodpublicsetExpires(int $expires) : \SetCookie

Parameters
Name Type Description
$expires int
Returns
Type Description
\SetCookie
methodpublicsetHttponly(bool $httponly) : void

Parameters
Name Type Description
$httponly bool
methodpublicsetMaxAge(integer $maxAge) : void

Set Max-Age

Parameters
Name Type Description
$maxAge integer
methodpublicsetName(string $name) : \SetCookie

Parameters
Name Type Description
$name string
Returns
Type Description
\SetCookie
methodpublicsetPath(string $path) : void

Parameters
Name Type Description
$path string
methodpublicsetSecure(boolean $secure) : void

Parameters
Name Type Description
$secure boolean
methodpublicsetValue(string $value) : void

Parameters
Name Type Description
$value string
methodpublicsetVersion(integer $version) : void

Set version

Parameters
Name Type Description
$version integer
methodpublictoString() : void

methodpublictoStringMultipleHeaders( $headers) : void

Parameters
Name Type Description
$headers
Documentation was generated by phpDocumentor 2.0.0a8.