SetCookieService uses CookieHeaderTrait, CookieScopeTrait
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.
Table of Contents
Properties
- $lifetime : int
- Lifetime for the session-cookie (on the client)
- $logger : LoggerInterface
- $loginType : string
- $name : string
Methods
- create() : self
- isCookieSet() : bool
- Returns whether this request is going to set a cookie or a cookie was already found in the system
- isRefreshTimeBasedCookie() : bool
- Determine whether a non-session cookie needs to be set (lifetime>0)
- isSetSessionCookie() : bool
- Determine whether a session cookie needs to be set (lifetime=0)
- removeCookie() : Cookie
- Empty / unset the cookie
- setSessionCookie() : Cookie|null
- Sets the session cookie for the current disposal.
Properties
$lifetime read-only
Lifetime for the session-cookie (on the client)
protected
int
$lifetime
If >0: permanent cookie with given lifetime If 0: session-cookie Session-cookie means the browser will remove it when the browser is closed.
$logger read-only
protected
LoggerInterface
$logger
$loginType read-only
protected
string
$loginType
$name read-only
protected
string
$name
Methods
create()
public
static create(string $name, string $type) : self
Parameters
- $name : string
- $type : string
Return values
selfisCookieSet()
Returns whether this request is going to set a cookie or a cookie was already found in the system
public
isCookieSet(ServerRequestInterface|null $request, UserSession|null $userSession) : bool
Parameters
- $request : ServerRequestInterface|null
- $userSession : UserSession|null
Return values
bool —Returns TRUE if a cookie is set
isRefreshTimeBasedCookie()
Determine whether a non-session cookie needs to be set (lifetime>0)
public
isRefreshTimeBasedCookie(UserSession $userSession) : bool
Parameters
- $userSession : UserSession
Return values
boolisSetSessionCookie()
Determine whether a session cookie needs to be set (lifetime=0)
public
isSetSessionCookie(UserSession $userSession[, bool $forceSetCookie = false ]) : bool
Parameters
- $userSession : UserSession
- $forceSetCookie : bool = false
Return values
boolremoveCookie()
Empty / unset the cookie
public
removeCookie(NormalizedParams $normalizedParams) : Cookie
Parameters
- $normalizedParams : NormalizedParams
Return values
CookiesetSessionCookie()
Sets the session cookie for the current disposal.
public
setSessionCookie(UserSession $userSession, NormalizedParams $normalizedParams) : Cookie|null
Parameters
- $userSession : UserSession
- $normalizedParams : NormalizedParams