Class Guzzle\Plugin\Cookie\Cookie

InheritanceGuzzle\Plugin\Cookie\Cookie
ImplementsGuzzle\Common\ToArrayInterface

Set-Cookie object

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$data array Cookie data Guzzle\Plugin\Cookie\Cookie
$invalidCharString string ASCII codes not valid for for use in a cookie name Cookie names are defined as 'token', according to RFC 2616, Section 2. Guzzle\Plugin\Cookie\Cookie

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Guzzle\Plugin\Cookie\Cookie
getAttribute() Get a specific data point from the extra cookie data Guzzle\Plugin\Cookie\Cookie
getAttributes() Get an array of extra cookie data Guzzle\Plugin\Cookie\Cookie
getComment() Get the comment Guzzle\Plugin\Cookie\Cookie
getCommentUrl() Get the comment URL of the cookie Guzzle\Plugin\Cookie\Cookie
getDiscard() Get whether or not this is a session cookie Guzzle\Plugin\Cookie\Cookie
getDomain() Get the domain Guzzle\Plugin\Cookie\Cookie
getExpires() The UNIX timestamp when the cookie expires Guzzle\Plugin\Cookie\Cookie
getHttpOnly() Get whether or not this is an HTTP only cookie Guzzle\Plugin\Cookie\Cookie
getMaxAge() Maximum lifetime of the cookie in seconds Guzzle\Plugin\Cookie\Cookie
getName() Get the cookie name Guzzle\Plugin\Cookie\Cookie
getPath() Get the path Guzzle\Plugin\Cookie\Cookie
getPorts() Get an array of acceptable ports this cookie can be used with Guzzle\Plugin\Cookie\Cookie
getSecure() Get whether or not this is a secure cookie Guzzle\Plugin\Cookie\Cookie
getValue() Get the cookie value Guzzle\Plugin\Cookie\Cookie
getVersion() Version of the cookie specification. RFC 2965 is 1 Guzzle\Plugin\Cookie\Cookie
isExpired() Check if the cookie is expired Guzzle\Plugin\Cookie\Cookie
matchesDomain() Check if the cookie matches a domain value Guzzle\Plugin\Cookie\Cookie
matchesPath() Check if the cookie matches a path value Guzzle\Plugin\Cookie\Cookie
matchesPort() Check if the cookie is compatible with a specific port Guzzle\Plugin\Cookie\Cookie
setAttribute() Set a cookie data attribute Guzzle\Plugin\Cookie\Cookie
setComment() Set the comment of the cookie Guzzle\Plugin\Cookie\Cookie
setCommentUrl() Set the comment URL of the cookie Guzzle\Plugin\Cookie\Cookie
setDiscard() Set whether or not this is a session cookie Guzzle\Plugin\Cookie\Cookie
setDomain() Set the domain of the cookie Guzzle\Plugin\Cookie\Cookie
setExpires() Set the unix timestamp for which the cookie will expire Guzzle\Plugin\Cookie\Cookie
setHttpOnly() Set whether or not this is an HTTP only cookie Guzzle\Plugin\Cookie\Cookie
setMaxAge() Set the max-age of the cookie Guzzle\Plugin\Cookie\Cookie
setName() Set the cookie name Guzzle\Plugin\Cookie\Cookie
setPath() Set the path of the cookie Guzzle\Plugin\Cookie\Cookie
setPorts() Set a list of acceptable ports this cookie can be used with Guzzle\Plugin\Cookie\Cookie
setSecure() Set whether or not the cookie is secure Guzzle\Plugin\Cookie\Cookie
setValue() Set the cookie value Guzzle\Plugin\Cookie\Cookie
setVersion() Set the cookie version Guzzle\Plugin\Cookie\Cookie
toArray() Get the cookie as an array Guzzle\Plugin\Cookie\Cookie
validate() Check if the cookie is valid according to RFC 6265 Guzzle\Plugin\Cookie\Cookie

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
getInvalidCharacters() Gets an array of invalid cookie characters Guzzle\Plugin\Cookie\Cookie

Property Details

$data protected property

Cookie data

protected array $data null
$invalidCharString protected static property

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

protected static string $invalidCharString null

Method Details

__construct() public method

public void __construct ( array $data = [] )
$data array

Array of cookie data provided by a Cookie parser

getAttribute() public method

Get a specific data point from the extra cookie data

public null|string getAttribute ( $name )
$name string

Name of the data point to retrieve

getAttributes() public method

Get an array of extra cookie data

public array getAttributes ( )
getComment() public method

Get the comment

public string|null getComment ( )
getCommentUrl() public method

Get the comment URL of the cookie

public string|null getCommentUrl ( )
getDiscard() public method

Get whether or not this is a session cookie

public null|bool getDiscard ( )
getDomain() public method

Get the domain

public string|null getDomain ( )
getExpires() public method

The UNIX timestamp when the cookie expires

public mixed getExpires ( )
getHttpOnly() public method

Get whether or not this is an HTTP only cookie

public bool getHttpOnly ( )
getInvalidCharacters() protected static method

Gets an array of invalid cookie characters

protected static array getInvalidCharacters ( )
getMaxAge() public method

Maximum lifetime of the cookie in seconds

public int|null getMaxAge ( )
getName() public method

Get the cookie name

public string getName ( )
getPath() public method

Get the path

public string getPath ( )
getPorts() public method

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

public array getPorts ( )
getSecure() public method

Get whether or not this is a secure cookie

public null|bool getSecure ( )
getValue() public method

Get the cookie value

public string getValue ( )
getVersion() public method

Version of the cookie specification. RFC 2965 is 1

public mixed getVersion ( )
isExpired() public method

Check if the cookie is expired

public bool isExpired ( )
matchesDomain() public method

Check if the cookie matches a domain value

public bool matchesDomain ( $domain )
$domain string

Domain to check against

matchesPath() public method

Check if the cookie matches a path value

public bool matchesPath ( $path )
$path string

Path to check against

matchesPort() public method

Check if the cookie is compatible with a specific port

public bool matchesPort ( $port )
$port int

Port to check

setAttribute() public method

Set a cookie data attribute

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

Name of the attribute to set

$value string

Value to set

setComment() public method

Set the comment of the cookie

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

Cookie comment

setCommentUrl() public method

Set the comment URL of the cookie

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

Cookie comment URL for more information

setDiscard() public method

Set whether or not this is a session cookie

public Guzzle\Plugin\Cookie\Cookie setDiscard ( $discard )
$discard bool

Set to true or false if this is a session cookie

setDomain() public method

Set the domain of the cookie

public Guzzle\Plugin\Cookie\Cookie setDomain ( $domain )
$domain string
setExpires() public method

Set the unix timestamp for which the cookie will expire

public Guzzle\Plugin\Cookie\Cookie setExpires ( $timestamp )
$timestamp int

Unix timestamp

setHttpOnly() public method

Set whether or not this is an HTTP only cookie

public Guzzle\Plugin\Cookie\Cookie setHttpOnly ( $httpOnly )
$httpOnly bool

Set to true or false if this is HTTP only

setMaxAge() public method

Set the max-age of the cookie

public Guzzle\Plugin\Cookie\Cookie setMaxAge ( $maxAge )
$maxAge int

Max age of the cookie in seconds

setName() public method

Set the cookie name

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

Cookie name

setPath() public method

Set the path of the cookie

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

Path of the cookie

setPorts() public method

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

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

Array of acceptable ports

setSecure() public method

Set whether or not the cookie is secure

public Guzzle\Plugin\Cookie\Cookie setSecure ( $secure )
$secure bool

Set to true or false if secure

setValue() public method

Set the cookie value

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

Cookie value

setVersion() public method

Set the cookie version

public Guzzle\Plugin\Cookie\Cookie setVersion ( $version )
$version string|int

Version to set

toArray() public method

Get the cookie as an array

public array toArray ( )
validate() public method

Check if the cookie is valid according to RFC 6265

public bool|string validate ( )
return bool|string

Returns true if valid or an error message if invalid