Properties

$data

$data : array

Type

array — Cookie data

$invalidCharString

$invalidCharString : string

Type

string — ASCII codes not valid for for use in a cookie name Cookie names are defined as 'token', according to RFC 2616, Section 2.2 A valid token may contain any CHAR except CTLs (ASCII 0 - 31 or 127) or any of the following separators

Methods

__construct()

__construct(array  $data = array()) 

Parameters

array $data

Array of cookie data provided by a Cookie parser

toArray()

toArray() : array

Get the cookie as an array

Returns

array

getName()

getName() : string

Get the cookie name

Returns

string

setName()

setName(string  $name) : \Guzzle\Plugin\Cookie\Cookie

Set the cookie name

Parameters

string $name

Cookie name

Returns

\Guzzle\Plugin\Cookie\Cookie

getValue()

getValue() : string

Get the cookie value

Returns

string

setValue()

setValue(string  $value) : \Guzzle\Plugin\Cookie\Cookie

Set the cookie value

Parameters

string $value

Cookie value

Returns

\Guzzle\Plugin\Cookie\Cookie

getDomain()

getDomain() : string|null

Get the domain

Returns

string|null

setDomain()

setDomain(string  $domain) : \Guzzle\Plugin\Cookie\Cookie

Set the domain of the cookie

Parameters

string $domain

Returns

\Guzzle\Plugin\Cookie\Cookie

getPath()

getPath() : string

Get the path

Returns

string

setPath()

setPath(string  $path) : \Guzzle\Plugin\Cookie\Cookie

Set the path of the cookie

Parameters

string $path

Path of the cookie

Returns

\Guzzle\Plugin\Cookie\Cookie

getMaxAge()

getMaxAge() : integer|null

Maximum lifetime of the cookie in seconds

Returns

integer|null

setMaxAge()

setMaxAge(integer  $maxAge) : \Guzzle\Plugin\Cookie\Cookie

Set the max-age of the cookie

Parameters

integer $maxAge

Max age of the cookie in seconds

Returns

\Guzzle\Plugin\Cookie\Cookie

getExpires()

getExpires() : mixed

The UNIX timestamp when the cookie expires

Returns

mixed

setExpires()

setExpires(integer  $timestamp) : \Guzzle\Plugin\Cookie\Cookie

Set the unix timestamp for which the cookie will expire

Parameters

integer $timestamp

Unix timestamp

Returns

\Guzzle\Plugin\Cookie\Cookie

getVersion()

getVersion() : mixed

Version of the cookie specification. RFC 2965 is 1

Returns

mixed

setVersion()

setVersion(string|integer  $version) : \Guzzle\Plugin\Cookie\Cookie

Set the cookie version

Parameters

string|integer $version

Version to set

Returns

\Guzzle\Plugin\Cookie\Cookie

getSecure()

getSecure() : null|boolean

Get whether or not this is a secure cookie

Returns

null|boolean

setSecure()

setSecure(boolean  $secure) : \Guzzle\Plugin\Cookie\Cookie

Set whether or not the cookie is secure

Parameters

boolean $secure

Set to true or false if secure

Returns

\Guzzle\Plugin\Cookie\Cookie

getDiscard()

getDiscard() : null|boolean

Get whether or not this is a session cookie

Returns

null|boolean

setDiscard()

setDiscard(boolean  $discard) : \Guzzle\Plugin\Cookie\Cookie

Set whether or not this is a session cookie

Parameters

boolean $discard

Set to true or false if this is a session cookie

Returns

\Guzzle\Plugin\Cookie\Cookie

getComment()

getComment() : string|null

Get the comment

Returns

string|null

setComment()

setComment(string  $comment) : \Guzzle\Plugin\Cookie\Cookie

Set the comment of the cookie

Parameters

string $comment

Cookie comment

Returns

\Guzzle\Plugin\Cookie\Cookie

getCommentUrl()

getCommentUrl() : string|null

Get the comment URL of the cookie

Returns

string|null

setCommentUrl()

setCommentUrl(string  $commentUrl) : \Guzzle\Plugin\Cookie\Cookie

Set the comment URL of the cookie

Parameters

string $commentUrl

Cookie comment URL for more information

Returns

\Guzzle\Plugin\Cookie\Cookie

getPorts()

getPorts() : array

Get an array of acceptable ports this cookie can be used with

Returns

array

setPorts()

setPorts(array  $ports) : \Guzzle\Plugin\Cookie\Cookie

Set a list of acceptable ports this cookie can be used with

Parameters

array $ports

Array of acceptable ports

Returns

\Guzzle\Plugin\Cookie\Cookie

getHttpOnly()

getHttpOnly() : boolean

Get whether or not this is an HTTP only cookie

Returns

boolean

setHttpOnly()

setHttpOnly(boolean  $httpOnly) : \Guzzle\Plugin\Cookie\Cookie

Set whether or not this is an HTTP only cookie

Parameters

boolean $httpOnly

Set to true or false if this is HTTP only

Returns

\Guzzle\Plugin\Cookie\Cookie

getAttributes()

getAttributes() : array

Get an array of extra cookie data

Returns

array

getAttribute()

getAttribute(string  $name) : null|string

Get a specific data point from the extra cookie data

Parameters

string $name

Name of the data point to retrieve

Returns

null|string

setAttribute()

setAttribute(string  $name, string  $value) : \Guzzle\Plugin\Cookie\Cookie

Set a cookie data attribute

Parameters

string $name

Name of the attribute to set

string $value

Value to set

Returns

\Guzzle\Plugin\Cookie\Cookie

matchesPath()

matchesPath(string  $path) : boolean

Check if the cookie matches a path value

Parameters

string $path

Path to check against

Returns

boolean

matchesDomain()

matchesDomain(string  $domain) : boolean

Check if the cookie matches a domain value

Parameters

string $domain

Domain to check against

Returns

boolean

matchesPort()

matchesPort(integer  $port) : boolean

Check if the cookie is compatible with a specific port

Parameters

integer $port

Port to check

Returns

boolean

isExpired()

isExpired() : boolean

Check if the cookie is expired

Returns

boolean

validate()

validate() : boolean|string

Check if the cookie is valid according to RFC 6265

Returns

boolean|string —

Returns true if valid or an error message if invalid

getInvalidCharacters()

getInvalidCharacters() : array

Gets an array of invalid cookie characters

Returns

array

setData()

setData(string  $key, string  $value) : \Guzzle\Plugin\Cookie\Cookie

Set a value and return the cookie object

Parameters

string $key

Key to set

string $value

Value to set

Returns

\Guzzle\Plugin\Cookie\Cookie