ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Dflydev\FigCookies\Cookie Class Reference
+ Collaboration diagram for Dflydev\FigCookies\Cookie:

Public Member Functions

 __construct ($name, $value=null)
 
 getName ()
 
 getValue ()
 
 withValue ($value=null)
 
 __toString ()
 Render Cookie as a string. More...
 

Static Public Member Functions

static create ($name, $value=null)
 Create a Cookie. More...
 
static listFromCookieString ($string)
 Create a list of Cookies from a Cookie header value string. More...
 

Private Attributes

 $name
 
 $value
 

Detailed Description

Definition at line 5 of file Cookie.php.

Constructor & Destructor Documentation

◆ __construct()

Dflydev\FigCookies\Cookie::__construct (   $name,
  $value = null 
)
Parameters
string$name
string | null$value

Definition at line 21 of file Cookie.php.

References Dflydev\FigCookies\Cookie\$name, and Dflydev\FigCookies\Cookie\$value.

22  {
23  $this->name = $name;
24  $this->value = $value;
25  }

Member Function Documentation

◆ __toString()

Dflydev\FigCookies\Cookie::__toString ( )

Render Cookie as a string.

Returns
string

Definition at line 61 of file Cookie.php.

62  {
63  return urlencode($this->name).'='.urlencode($this->value);
64  }

◆ create()

◆ getName()

Dflydev\FigCookies\Cookie::getName ( )
Returns
string

Definition at line 30 of file Cookie.php.

References Dflydev\FigCookies\Cookie\$name.

Referenced by Dflydev\FigCookies\CookieTest\assertCookieNameAndValue(), Dflydev\FigCookies\FigRequestCookiesTest\it_modifies_cookies(), and Dflydev\FigCookies\Cookies\with().

31  {
32  return $this->name;
33  }
+ Here is the caller graph for this function:

◆ getValue()

Dflydev\FigCookies\Cookie::getValue ( )
Returns
string|null

Definition at line 38 of file Cookie.php.

References Dflydev\FigCookies\Cookie\$value.

Referenced by Dflydev\FigCookies\CookieTest\assertCookieNameAndValue(), and Dflydev\FigCookies\FigCookiesTest\it_encrypts_and_decrypts_cookies().

39  {
40  return $this->value;
41  }
+ Here is the caller graph for this function:

◆ listFromCookieString()

static Dflydev\FigCookies\Cookie::listFromCookieString (   $string)
static

Create a list of Cookies from a Cookie header value string.

Parameters
string$string
Returns
Cookie[]

Definition at line 84 of file Cookie.php.

References $cookieName, Dflydev\FigCookies\StringUtil\splitCookiePair(), and Dflydev\FigCookies\StringUtil\splitOnAttributeDelimiter().

Referenced by Dflydev\FigCookies\Cookies\fromCookieString(), and Dflydev\FigCookies\CookieTest\it_parses_list_from_cookie_string().

85  {
86  $cookies = StringUtil::splitOnAttributeDelimiter($string);
87 
88  return array_map(function ($cookiePair) {
89  return static::oneFromCookiePair($cookiePair);
90  }, $cookies);
91  }
static splitOnAttributeDelimiter($string)
Definition: StringUtil.php:7
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ withValue()

Dflydev\FigCookies\Cookie::withValue (   $value = null)
Parameters
string | null$value
Returns
Cookie

Definition at line 47 of file Cookie.php.

References Dflydev\FigCookies\Cookie\$value.

Referenced by Dflydev\FigCookies\FigCookiesTest\it_encrypts_and_decrypts_cookies(), and Dflydev\FigCookies\FigRequestCookiesTest\it_modifies_cookies().

48  {
49  $clone = clone($this);
50 
51  $clone->value = $value;
52 
53  return $clone;
54  }
+ Here is the caller graph for this function:

Field Documentation

◆ $name

Dflydev\FigCookies\Cookie::$name
private

◆ $value


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