PHP Class Neos\Flow\Http\Cookie

See also: http://tools.ietf.org/html/rfc6265
Afficher le fichier Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Свойство Type Description
$domain string Hosts to which this cookie will be sent (RFC 6265, 4.1.2.3)
$expiresTimestamp integer Unix timestamp of the expiration date / time or 0 for "session" expiration (RFC 6265, 4.1.2.1)
$httpOnly boolean
$maximumAge integer Number of seconds until the cookie expires (RFC 6265, 4.1.2.2)
$name string Cookie Name, a token (RFC 6265, 4.1.1)
$path string
$secure boolean
$value string

Méthodes publiques

Méthode Description
__construct ( string $name, mixed $value = null, integer | DateTime $expires, integer $maximumAge = null, string $domain = null, string $path = '/', boolean $secure = false, boolean $httpOnly = true ) Constructs a new Cookie object
__toString ( ) : string Renders the field value suitable for a HTTP "Set-Cookie" header.
createFromRawSetCookieHeader ( string $header ) : Cookie Creates a cookie (an instance of this class) by a provided raw header string like "foo=507d9f20317a5; path=/; domain=.example.org" This is is an implementation of the algorithm explained in RFC 6265, Section 5.2 A basic statement of this algorithm is to "ignore the set-cookie-string entirely" in case a required condition is not met. In these cases this function will return NULL rather than the created cookie.
expire ( ) : void Marks this cookie for removal.
getDomain ( ) : string Returns the domain this cookie is valid for.
getExpires ( ) : integer Returns the date and time of the Expires attribute, if any.
getMaximumAge ( ) : integer Returns the number of seconds until the cookie expires, if defined.
getName ( ) : string Returns the name of this cookie
getPath ( ) : string Returns the path this cookie is valid for.
getValue ( ) : mixed Returns the value of this cookie
isExpired ( ) : boolean Tells if this cookie is expired and will be removed in the user agent when it received the response containing this cookie.
isHttpOnly ( ) : boolean Tells if this cookie should only be used through the HTTP protocol.
isSecure ( ) : boolean Tells if the cookie was flagged to be sent over "secure" channels only.
setValue ( mixed $value ) : void Sets the value of this cookie

Method Details

__construct() public méthode

Constructs a new Cookie object
public __construct ( string $name, mixed $value = null, integer | DateTime $expires, integer $maximumAge = null, string $domain = null, string $path = '/', boolean $secure = false, boolean $httpOnly = true )
$name string The cookie name as a valid token (RFC 2616)
$value mixed The value to store in the cookie. Must be possible to cast into a string.
$expires integer | DateTime Date and time after which this cookie expires.
$maximumAge integer Number of seconds until the cookie expires.
$domain string The host to which the user agent will send this cookie
$path string The path describing the scope of this cookie
$secure boolean If this cookie should only be sent through a "secure" channel by the user agent
$httpOnly boolean If this cookie should only be used through the HTTP protocol

__toString() public méthode

Renders the field value suitable for a HTTP "Set-Cookie" header.
public __toString ( ) : string
Résultat string

createFromRawSetCookieHeader() public static méthode

Creates a cookie (an instance of this class) by a provided raw header string like "foo=507d9f20317a5; path=/; domain=.example.org" This is is an implementation of the algorithm explained in RFC 6265, Section 5.2 A basic statement of this algorithm is to "ignore the set-cookie-string entirely" in case a required condition is not met. In these cases this function will return NULL rather than the created cookie.
See also: http://tools.ietf.org/html/rfc6265
public static createFromRawSetCookieHeader ( string $header ) : Cookie
$header string The Set-Cookie string without the actual "Set-Cookie:" part
Résultat Cookie

expire() public méthode

On executing this method, the expiry time of this cookie is set to a point in time in the past triggers the removal of the cookie in the user agent.
public expire ( ) : void
Résultat void

getDomain() public méthode

Returns the domain this cookie is valid for.
public getDomain ( ) : string
Résultat string The domain name

getExpires() public méthode

Note that this date / time is returned as a unix timestamp, no matter what the format was originally set through the constructor of this Cookie. The special case "no expiration time" is returned in form of a zero value.
public getExpires ( ) : integer
Résultat integer A unix timestamp or 0

getMaximumAge() public méthode

This information is rendered as the Max-Age attribute (RFC 6265, 4.1.2.2). Note that not all browsers support this attribute.
public getMaximumAge ( ) : integer
Résultat integer The maximum age in seconds, or NULL if none has been defined.

getName() public méthode

Returns the name of this cookie
public getName ( ) : string
Résultat string The cookie name

getPath() public méthode

Returns the path this cookie is valid for.
public getPath ( ) : string
Résultat string The path

getValue() public méthode

Returns the value of this cookie
public getValue ( ) : mixed
Résultat mixed

isExpired() public méthode

Tells if this cookie is expired and will be removed in the user agent when it received the response containing this cookie.
public isExpired ( ) : boolean
Résultat boolean True if this cookie is expired

isHttpOnly() public méthode

Tells if this cookie should only be used through the HTTP protocol.
public isHttpOnly ( ) : boolean
Résultat boolean State of the "HttpOnly" attribute

isSecure() public méthode

This security measure only has a limited effect. Please read RFC 6265 Section 8.6 for more details.
public isSecure ( ) : boolean
Résultat boolean State of the "Secure" attribute

setValue() public méthode

Sets the value of this cookie
public setValue ( mixed $value ) : void
$value mixed The new value
Résultat void

Property Details

$domain protected_oe property

Hosts to which this cookie will be sent (RFC 6265, 4.1.2.3)
protected string $domain
Résultat string

$expiresTimestamp protected_oe property

Unix timestamp of the expiration date / time or 0 for "session" expiration (RFC 6265, 4.1.2.1)
protected int $expiresTimestamp
Résultat integer

$httpOnly protected_oe property

protected bool $httpOnly
Résultat boolean

$maximumAge protected_oe property

Number of seconds until the cookie expires (RFC 6265, 4.1.2.2)
protected int $maximumAge
Résultat integer

$name protected_oe property

Cookie Name, a token (RFC 6265, 4.1.1)
protected string $name
Résultat string

$path protected_oe property

protected string $path
Résultat string

$secure protected_oe property

protected bool $secure
Résultat boolean

$value protected_oe property

protected string $value
Résultat string