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

Static Public Member Functions

static get (ResponseInterface $response, $name, $value=null)
 
static set (ResponseInterface $response, SetCookie $setCookie)
 
static expire (ResponseInterface $response, $cookieName)
 
static modify (ResponseInterface $response, $name, $modify)
 
static remove (ResponseInterface $response, $name)
 

Detailed Description

Definition at line 8 of file FigResponseCookies.php.

Member Function Documentation

◆ expire()

static Dflydev\FigCookies\FigResponseCookies::expire ( ResponseInterface  $response,
  $cookieName 
)
static
Parameters
ResponseInterface$response
string$cookieName
Returns
ResponseInterface

Definition at line 47 of file FigResponseCookies.php.

References $cookieName, and Dflydev\FigCookies\SetCookie\createExpired().

48  {
49  return static::set($response, SetCookie::createExpired($cookieName));
50  }
$cookieName
$response
+ Here is the call graph for this function:

◆ get()

static Dflydev\FigCookies\FigResponseCookies::get ( ResponseInterface  $response,
  $name,
  $value = null 
)
static
Parameters
ResponseInterface$response
string$name
string | null$value
Returns
SetCookie

Definition at line 17 of file FigResponseCookies.php.

References Dflydev\FigCookies\SetCookie\create(), and Dflydev\FigCookies\SetCookies\fromResponse().

Referenced by Dflydev\FigCookies\FigResponseCookiesTest\it_gets_cookies().

18  {
19  $setCookies = SetCookies::fromResponse($response);
20  if ($setCookies->has($name)) {
21  return $setCookies->get($name);
22  }
23 
24  return SetCookie::create($name, $value);
25  }
static fromResponse(ResponseInterface $response)
Create SetCookies from a Response.
Definition: SetCookies.php:124
static create($name, $value=null)
Definition: SetCookie.php:173
$response
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ modify()

static Dflydev\FigCookies\FigResponseCookies::modify ( ResponseInterface  $response,
  $name,
  $modify 
)
static
Parameters
ResponseInterface$response
string$name
callable$modify
Returns
ResponseInterface

Definition at line 59 of file FigResponseCookies.php.

References Dflydev\FigCookies\SetCookie\create(), and Dflydev\FigCookies\SetCookies\fromResponse().

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

60  {
61  if (! is_callable($modify)) {
62  throw new InvalidArgumentException('$modify must be callable.');
63  }
64 
65  $setCookies = SetCookies::fromResponse($response);
66  $setCookie = $modify($setCookies->has($name)
67  ? $setCookies->get($name)
69  );
70 
71  return $setCookies
72  ->with($setCookie)
73  ->renderIntoSetCookieHeader($response)
74  ;
75  }
static fromResponse(ResponseInterface $response)
Create SetCookies from a Response.
Definition: SetCookies.php:124
static create($name, $value=null)
Definition: SetCookie.php:173
$response
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remove()

static Dflydev\FigCookies\FigResponseCookies::remove ( ResponseInterface  $response,
  $name 
)
static
Parameters
ResponseInterface$response
string$name
Returns
ResponseInterface

Definition at line 83 of file FigResponseCookies.php.

References Dflydev\FigCookies\SetCookies\fromResponse().

Referenced by Dflydev\FigCookies\FigResponseCookiesTest\it_removes_cookies().

84  {
86  ->without($name)
87  ->renderIntoSetCookieHeader($response)
88  ;
89  }
static fromResponse(ResponseInterface $response)
Create SetCookies from a Response.
Definition: SetCookies.php:124
$response
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set()

static Dflydev\FigCookies\FigResponseCookies::set ( ResponseInterface  $response,
SetCookie  $setCookie 
)
static
Parameters
ResponseInterface$response
SetCookie$setCookie
Returns
ResponseInterface

Definition at line 33 of file FigResponseCookies.php.

References Dflydev\FigCookies\SetCookies\fromResponse().

Referenced by Dflydev\FigCookies\FigResponseCookiesTest\it_sets_cookies().

34  {
36  ->with($setCookie)
37  ->renderIntoSetCookieHeader($response)
38  ;
39  }
static fromResponse(ResponseInterface $response)
Create SetCookies from a Response.
Definition: SetCookies.php:124
$response
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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