‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Http\SetCookieService Class Reference
Inheritance diagram for TYPO3\CMS\Core\Http\SetCookieService:
TYPO3\CMS\Core\Http\CookieHeaderTrait TYPO3\CMS\Core\Http\CookieScopeTrait

Public Member Functions

 setSessionCookie (UserSession $userSession, NormalizedParams $normalizedParams)
 
 isSetSessionCookie (UserSession $userSession, bool $forceSetCookie=false)
 
 isRefreshTimeBasedCookie (UserSession $userSession)
 
bool isCookieSet (?ServerRequestInterface $request, ?UserSession $userSession)
 
 removeCookie (NormalizedParams $normalizedParams)
 

Static Public Member Functions

static create (string $name, string $type)
 

Protected Attributes

readonly LoggerInterface $logger
 

Private Member Functions

 __construct (protected readonly string $name, protected readonly string $loginType, protected readonly int $lifetime)
 

Detailed Description

Class that is used to apply a SetCookie to a response, based on the current (authenticated or stateful) session, in order to use the same session across multiple HTTP requests.

Definition at line 32 of file SetCookieService.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Http\SetCookieService::__construct ( protected readonly string  $name,
protected readonly string  $loginType,
protected readonly int  $lifetime 
)
private
Parameters
$lifetime‪Lifetime for the session-cookie (on the client)

If >0: permanent cookie with given lifetime If 0: session-cookie Session-cookie means the browser will remove it when the browser is closed.

Definition at line 43 of file SetCookieService.php.

Member Function Documentation

◆ create()

◆ isCookieSet()

bool TYPO3\CMS\Core\Http\SetCookieService::isCookieSet ( ?ServerRequestInterface  $request,
?UserSession  $userSession 
)

Returns whether this request is going to set a cookie or a cookie was already found in the system

Returns
‪bool Returns TRUE if a cookie is set

Definition at line 136 of file SetCookieService.php.

References TYPO3\CMS\Core\Http\SetCookieService\isRefreshTimeBasedCookie(), and TYPO3\CMS\Core\Http\SetCookieService\isSetSessionCookie().

◆ isRefreshTimeBasedCookie()

TYPO3\CMS\Core\Http\SetCookieService::isRefreshTimeBasedCookie ( UserSession  $userSession)

Determine whether a non-session cookie needs to be set (lifetime>0)

Definition at line 122 of file SetCookieService.php.

References TYPO3\CMS\Core\Session\UserSession\isPermanent().

Referenced by TYPO3\CMS\Core\Http\SetCookieService\isCookieSet(), and TYPO3\CMS\Core\Http\SetCookieService\setSessionCookie().

◆ isSetSessionCookie()

TYPO3\CMS\Core\Http\SetCookieService::isSetSessionCookie ( UserSession  $userSession,
bool  $forceSetCookie = false 
)

◆ removeCookie()

TYPO3\CMS\Core\Http\SetCookieService::removeCookie ( NormalizedParams  $normalizedParams)

Empty / unset the cookie

Definition at line 151 of file SetCookieService.php.

References TYPO3\CMS\Core\Http\CookieScopeTrait\getCookieScope().

◆ setSessionCookie()

Member Data Documentation

◆ $logger

readonly LoggerInterface TYPO3\CMS\Core\Http\SetCookieService::$logger
protected

Definition at line 35 of file SetCookieService.php.