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

Methods

create()

public static create(string $name, string $type) : self
Parameters
$name : string
$type : string
Return values
self

isCookieSet()

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
Internal
Return values
bool

isSetSessionCookie()

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
bool

        
On this page

Search results