Class Cookie
Set-Cookie object
- Guzzle\Plugin\Cookie\Cookie implements Guzzle\Common\ToArrayInterface
Methods summary
-
protected staticgetInvalidCharacters ( )Gets an array of invalid cookie characters
-
public__construct ( array $data = array() ) -
publictoArray ( )Get the cookie as an array
-
publicgetName ( )Get the cookie name
-
publicsetName ( string $name )Set the cookie name
-
publicgetValue ( )Get the cookie value
-
publicsetValue ( string $value )Set the cookie value
-
publicgetDomain ( )Get the domain
-
publicsetDomain ( string $domain )Set the domain of the cookie
-
publicgetPath ( )Get the path
-
publicsetPath ( string $path )Set the path of the cookie
-
publicgetMaxAge ( )Maximum lifetime of the cookie in seconds
-
publicsetMaxAge ( int $maxAge )Set the max-age of the cookie
-
publicgetExpires ( )The UNIX timestamp when the cookie expires
-
publicsetExpires ( int $timestamp )Set the unix timestamp for which the cookie will expire
-
publicgetVersion ( )Version of the cookie specification. RFC 2965 is 1
-
publicsetVersion ( string|int $version )Set the cookie version
-
publicgetSecure ( )Get whether or not this is a secure cookie
-
publicsetSecure ( bool $secure )Set whether or not the cookie is secure
-
publicgetDiscard ( )Get whether or not this is a session cookie
-
publicsetDiscard ( bool $discard )Set whether or not this is a session cookie
-
publicgetComment ( )Get the comment
-
publicsetComment ( string $comment )Set the comment of the cookie
-
publicgetCommentUrl ( )Get the comment URL of the cookie
-
publicsetCommentUrl ( string $commentUrl )Set the comment URL of the cookie
-
publicgetPorts ( )Get an array of acceptable ports this cookie can be used with
-
publicsetPorts ( array $ports )Set a list of acceptable ports this cookie can be used with
-
publicgetHttpOnly ( )Get whether or not this is an HTTP only cookie
-
publicsetHttpOnly ( bool $httpOnly )Set whether or not this is an HTTP only cookie
-
publicgetAttributes ( )Get an array of extra cookie data
-
publicgetAttribute ( string $name )Get a specific data point from the extra cookie data
-
publicsetAttribute ( string $name, string $value )Set a cookie data attribute
-
publicmatchesPath ( string $path )Check if the cookie matches a path value
-
publicmatchesDomain ( string $domain )Check if the cookie matches a domain value
-
publicmatchesPort ( int $port )Check if the cookie is compatible with a specific port
-
publicisExpired ( )Check if the cookie is expired
-
publicvalidate ( )Check if the cookie is valid according to RFC 6265
Methods detail
Gets an array of invalid cookie characters
Returns
arrayParameters
- $data
array
$data Array of cookie data provided by a Cookie parser
Get the cookie as an array
Returns
arrayImplementation of
Get the cookie name
Returns
stringGet the cookie value
Returns
stringSet the cookie value
Parameters
- $value
string
$value Cookie value
Returns
Get the domain
Returns
string|nullGet the path
Returns
stringSet the path of the cookie
Parameters
- $path
string
$path Path of the cookie
Returns
Maximum lifetime of the cookie in seconds
Returns
integer|nullSet 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
mixedSet 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
mixedSet the cookie version
Parameters
- $version
string|integer
$version Version to set
Returns
Get whether or not this is a secure cookie
Returns
null|booleanSet 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|booleanSet 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|nullSet the comment of the cookie
Parameters
- $comment
string
$comment Cookie comment
Returns
Get the comment URL of the cookie
Returns
string|nullSet 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
arraySet 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
booleanSet 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
arrayGet a specific data point from the extra cookie data
Parameters
- $name
string
$name Name of the data point to retrieve
Returns
null|stringSet 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
booleanCheck if the cookie matches a domain value
Parameters
- $domain
string
$domain Domain to check against
Returns
booleanCheck if the cookie is compatible with a specific port
Parameters
- $port
integer
$port Port to check
Returns
booleanCheck if the cookie is expired
Returns
booleanCheck if the cookie is valid according to RFC 6265
Returns
boolean|stringReturns 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 |