Class Cookie
Set-Cookie object
- Guzzle\Plugin\Cookie\Cookie implements Guzzle\Common\ToArrayInterface
Methods summary
-
protected static
getInvalidCharacters ( )
Gets an array of invalid cookie characters
-
public
__construct ( array $data = array() )
-
public
toArray ( )
Get the cookie as an array
-
public
getName ( )
Get the cookie name
-
public
setName ( string $name )
Set the cookie name
-
public
getValue ( )
Get the cookie value
-
public
setValue ( string $value )
Set the cookie value
-
public
getDomain ( )
Get the domain
-
public
setDomain ( string $domain )
Set the domain of the cookie
-
public
getPath ( )
Get the path
-
public
setPath ( string $path )
Set the path of the cookie
-
public
getMaxAge ( )
Maximum lifetime of the cookie in seconds
-
public
setMaxAge ( int $maxAge )
Set the max-age of the cookie
-
public
getExpires ( )
The UNIX timestamp when the cookie expires
-
public
setExpires ( int $timestamp )
Set the unix timestamp for which the cookie will expire
-
public
getVersion ( )
Version of the cookie specification. RFC 2965 is 1
-
public
setVersion ( string|int $version )
Set the cookie version
-
public
getSecure ( )
Get whether or not this is a secure cookie
-
public
setSecure ( bool $secure )
Set whether or not the cookie is secure
-
public
getDiscard ( )
Get whether or not this is a session cookie
-
public
setDiscard ( bool $discard )
Set whether or not this is a session cookie
-
public
getComment ( )
Get the comment
-
public
setComment ( string $comment )
Set the comment of the cookie
-
public
getCommentUrl ( )
Get the comment URL of the cookie
-
public
setCommentUrl ( string $commentUrl )
Set the comment URL of the cookie
-
public
getPorts ( )
Get an array of acceptable ports this cookie can be used with
-
public
setPorts ( array $ports )
Set a list of acceptable ports this cookie can be used with
-
public
getHttpOnly ( )
Get whether or not this is an HTTP only cookie
-
public
setHttpOnly ( bool $httpOnly )
Set whether or not this is an HTTP only cookie
-
public
getAttributes ( )
Get an array of extra cookie data
-
public
getAttribute ( string $name )
Get a specific data point from the extra cookie data
-
public
setAttribute ( string $name, string $value )
Set a cookie data attribute
-
public
matchesPath ( string $path )
Check if the cookie matches a path value
-
public
matchesDomain ( string $domain )
Check if the cookie matches a domain value
-
public
matchesPort ( int $port )
Check if the cookie is compatible with a specific port
-
public
isExpired ( )
Check if the cookie is expired
-
public
validate ( )
Check if the cookie is valid according to RFC 6265
Methods detail
Gets an array of invalid cookie characters
Returns
array
Parameters
- $data
array
$data Array of cookie data provided by a Cookie parser
Get the cookie as an array
Returns
array
Implementation of
Get the cookie name
Returns
string
Get the cookie value
Returns
string
Set the cookie value
Parameters
- $value
string
$value Cookie value
Returns
Get the domain
Returns
string|null
Get the path
Returns
string
Set the path of the cookie
Parameters
- $path
string
$path Path of the cookie
Returns
Maximum lifetime of the cookie in seconds
Returns
integer|null
Set the max-age of the cookie
Parameters
- $maxAge
integer
$maxAge Max age of the cookie in seconds
Returns
The UNIX timestamp when the cookie expires
Returns
mixed
Set the unix timestamp for which the cookie will expire
Parameters
- $timestamp
integer
$timestamp Unix timestamp
Returns
Version of the cookie specification. RFC 2965 is 1
Returns
mixed
Set the cookie version
Parameters
- $version
string|integer
$version Version to set
Returns
Get whether or not this is a secure cookie
Returns
null|boolean
Set whether or not the cookie is secure
Parameters
- $secure
boolean
$secure Set to true or false if secure
Returns
Get whether or not this is a session cookie
Returns
null|boolean
Set whether or not this is a session cookie
Parameters
- $discard
boolean
$discard Set to true or false if this is a session cookie
Returns
Get the comment
Returns
string|null
Set the comment of the cookie
Parameters
- $comment
string
$comment Cookie comment
Returns
Get the comment URL of the cookie
Returns
string|null
Set the comment URL of the cookie
Parameters
- $commentUrl
string
$commentUrl Cookie comment URL for more information
Returns
Get an array of acceptable ports this cookie can be used with
Returns
array
Set a list of acceptable ports this cookie can be used with
Parameters
- $ports
array
$ports Array of acceptable ports
Returns
Get whether or not this is an HTTP only cookie
Returns
boolean
Set whether or not this is an HTTP only cookie
Parameters
- $httpOnly
boolean
$httpOnly Set to true or false if this is HTTP only
Returns
Get an array of extra cookie data
Returns
array
Get a specific data point from the extra cookie data
Parameters
- $name
string
$name Name of the data point to retrieve
Returns
null|string
Set a cookie data attribute
Parameters
- $name
string
$name Name of the attribute to set- $value
string
$value Value to set
Returns
Check if the cookie matches a path value
Parameters
- $path
string
$path Path to check against
Returns
boolean
Check if the cookie matches a domain value
Parameters
- $domain
string
$domain Domain to check against
Returns
boolean
Check if the cookie is compatible with a specific port
Parameters
- $port
integer
$port Port to check
Returns
boolean
Check if the cookie is expired
Returns
boolean
Check if the cookie is valid according to RFC 6265
Returns
boolean|string
Returns true if valid or an error message if invalid
Magic methods summary
Properties summary
protected
array
|
$data |
#
Cookie data |
protected static
string
|
$invalidCharString |
#
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 |