Open Monograph Press  3.3.0
GuzzleHttp\Cookie\SetCookie Class Reference

Public Member Functions

 __construct (array $data=[])
 
 __toString ()
 
 getDiscard ()
 
 getDomain ()
 
 getExpires ()
 
 getHttpOnly ()
 
 getMaxAge ()
 
 getName ()
 
 getPath ()
 
 getSecure ()
 
 getValue ()
 
 isExpired ()
 
 matchesDomain ($domain)
 
 matchesPath ($requestPath)
 
 setDiscard ($discard)
 
 setDomain ($domain)
 
 setExpires ($timestamp)
 
 setHttpOnly ($httpOnly)
 
 setMaxAge ($maxAge)
 
 setName ($name)
 
 setPath ($path)
 
 setSecure ($secure)
 
 setValue ($value)
 
 toArray ()
 
 validate ()
 

Static Public Member Functions

static fromString ($cookie)
 

Detailed Description

Set-Cookie object

Definition at line 7 of file SetCookie.php.

Constructor & Destructor Documentation

◆ __construct()

GuzzleHttp\Cookie\SetCookie::__construct ( array  $data = [])
Parameters
array$dataArray of cookie data provided by a Cookie parser

Definition at line 75 of file SetCookie.php.

References GuzzleHttp\Cookie\SetCookie\getExpires(), GuzzleHttp\Cookie\SetCookie\getMaxAge(), and GuzzleHttp\Cookie\SetCookie\setExpires().

Member Function Documentation

◆ __toString()

GuzzleHttp\Cookie\SetCookie::__toString ( )

Definition at line 87 of file SetCookie.php.

◆ fromString()

static GuzzleHttp\Cookie\SetCookie::fromString (   $cookie)
static

Create a new SetCookie object from a string

Parameters
string$cookieSet-Cookie header string
Returns
self

Definition at line 35 of file SetCookie.php.

Referenced by GuzzleHttp\Cookie\CookieJar\extractCookies().

◆ getDiscard()

GuzzleHttp\Cookie\SetCookie::getDiscard ( )

Get whether or not this is a session cookie

Returns
bool|null

Definition at line 255 of file SetCookie.php.

Referenced by GuzzleHttp\Cookie\CookieJar\clearSessionCookies(), GuzzleHttp\Cookie\CookieJar\setCookie(), and GuzzleHttp\Cookie\CookieJar\shouldPersist().

◆ getDomain()

GuzzleHttp\Cookie\SetCookie::getDomain ( )

◆ getExpires()

GuzzleHttp\Cookie\SetCookie::getExpires ( )

◆ getHttpOnly()

GuzzleHttp\Cookie\SetCookie::getHttpOnly ( )

Get whether or not this is an HTTP only cookie

Returns
bool

Definition at line 275 of file SetCookie.php.

◆ getMaxAge()

GuzzleHttp\Cookie\SetCookie::getMaxAge ( )

Maximum lifetime of the cookie in seconds

Returns
int|null

Definition at line 193 of file SetCookie.php.

Referenced by GuzzleHttp\Cookie\SetCookie\__construct().

◆ getName()

GuzzleHttp\Cookie\SetCookie::getName ( )

Get the cookie name

Returns
string

Definition at line 113 of file SetCookie.php.

Referenced by GuzzleHttp\Cookie\CookieJar\clear(), GuzzleHttp\Cookie\CookieJar\setCookie(), and GuzzleHttp\Cookie\SetCookie\validate().

◆ getPath()

GuzzleHttp\Cookie\SetCookie::getPath ( )

Get the path

Returns
string

Definition at line 173 of file SetCookie.php.

Referenced by GuzzleHttp\Cookie\SetCookie\matchesPath(), and GuzzleHttp\Cookie\CookieJar\setCookie().

◆ getSecure()

GuzzleHttp\Cookie\SetCookie::getSecure ( )

Get whether or not this is a secure cookie

Returns
bool|null

Definition at line 235 of file SetCookie.php.

◆ getValue()

GuzzleHttp\Cookie\SetCookie::getValue ( )

Get the cookie value

Returns
string

Definition at line 133 of file SetCookie.php.

Referenced by GuzzleHttp\Cookie\CookieJar\setCookie(), and GuzzleHttp\Cookie\SetCookie\validate().

◆ isExpired()

GuzzleHttp\Cookie\SetCookie::isExpired ( )

Check if the cookie is expired

Returns
bool

Definition at line 362 of file SetCookie.php.

References GuzzleHttp\Cookie\SetCookie\getExpires().

◆ matchesDomain()

GuzzleHttp\Cookie\SetCookie::matchesDomain (   $domain)

Check if the cookie matches a domain value

Parameters
string$domainDomain to check against
Returns
bool

Definition at line 337 of file SetCookie.php.

References GuzzleHttp\Cookie\SetCookie\getDomain().

Referenced by GuzzleHttp\Cookie\CookieJar\clear().

◆ matchesPath()

GuzzleHttp\Cookie\SetCookie::matchesPath (   $requestPath)

Check if the cookie matches a path value.

A request-path path-matches a given cookie-path if at least one of the following conditions holds:

  • The cookie-path and the request-path are identical.
  • The cookie-path is a prefix of the request-path, and the last character of the cookie-path is x2F ("/").
  • The cookie-path is a prefix of the request-path, and the first character of the request-path that is not included in the cookie- path is a x2F ("/") character.
Parameters
string$requestPathPath to check against
Returns
bool

Definition at line 307 of file SetCookie.php.

References $requestPath, and GuzzleHttp\Cookie\SetCookie\getPath().

Referenced by GuzzleHttp\Cookie\CookieJar\clear().

◆ setDiscard()

GuzzleHttp\Cookie\SetCookie::setDiscard (   $discard)

Set whether or not this is a session cookie

Parameters
bool$discardSet to true or false if this is a session cookie

Definition at line 265 of file SetCookie.php.

◆ setDomain()

GuzzleHttp\Cookie\SetCookie::setDomain (   $domain)

Set the domain of the cookie

Parameters
string$domain

Definition at line 163 of file SetCookie.php.

◆ setExpires()

GuzzleHttp\Cookie\SetCookie::setExpires (   $timestamp)

Set the unix timestamp for which the cookie will expire

Parameters
int$timestampUnix timestamp

Definition at line 223 of file SetCookie.php.

Referenced by GuzzleHttp\Cookie\SetCookie\__construct().

◆ setHttpOnly()

GuzzleHttp\Cookie\SetCookie::setHttpOnly (   $httpOnly)

Set whether or not this is an HTTP only cookie

Parameters
bool$httpOnlySet to true or false if this is HTTP only

Definition at line 285 of file SetCookie.php.

◆ setMaxAge()

GuzzleHttp\Cookie\SetCookie::setMaxAge (   $maxAge)

Set the max-age of the cookie

Parameters
int$maxAgeMax age of the cookie in seconds

Definition at line 203 of file SetCookie.php.

◆ setName()

GuzzleHttp\Cookie\SetCookie::setName (   $name)

Set the cookie name

Parameters
string$nameCookie name

Definition at line 123 of file SetCookie.php.

◆ setPath()

GuzzleHttp\Cookie\SetCookie::setPath (   $path)

Set the path of the cookie

Parameters
string$pathPath of the cookie

Definition at line 183 of file SetCookie.php.

◆ setSecure()

GuzzleHttp\Cookie\SetCookie::setSecure (   $secure)

Set whether or not the cookie is secure

Parameters
bool$secureSet to true or false if secure

Definition at line 245 of file SetCookie.php.

◆ setValue()

GuzzleHttp\Cookie\SetCookie::setValue (   $value)

Set the cookie value

Parameters
string$valueCookie value

Definition at line 143 of file SetCookie.php.

◆ toArray()

GuzzleHttp\Cookie\SetCookie::toArray ( )

Definition at line 103 of file SetCookie.php.

Referenced by GuzzleHttp\Cookie\CookieJar\toArray().

◆ validate()

GuzzleHttp\Cookie\SetCookie::validate ( )

Check if the cookie is valid according to RFC 6265

Returns
bool|string Returns true if valid or an error message if invalid

Definition at line 372 of file SetCookie.php.

References GuzzleHttp\Cookie\SetCookie\getDomain(), GuzzleHttp\Cookie\SetCookie\getName(), and GuzzleHttp\Cookie\SetCookie\getValue().

Referenced by GuzzleHttp\Cookie\CookieJar\setCookie().


The documentation for this class was generated from the following file: