PHP Class Nette\Http\Session

Inheritance: use trait Nette\SmartObject
Afficher le fichier Open project: nette/http Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( Nette\Http\IRequest $request, Nette\Http\IResponse $response )
clean ( ) : void Cleans and minimizes meta structures. This method is called automatically on shutdown, do not call it directly.
close ( ) : void Ends the current session and store session data.
destroy ( ) : void Destroys all data registered to a session.
exists ( ) : boolean Does session exists for the current request?
getCookieParameters ( ) : array Returns the session cookie parameters.
getId ( ) : string Returns the current session ID. Don't make dependencies, can be changed for each request.
getIterator ( ) : ArrayIterator Iteration over all sections.
getName ( ) : string Gets the session name.
getOptions ( ) : array Returns all session options.
getSection ( $section, $class = SessionSection::class ) : SessionSection Returns specified session section.
hasSection ( $section ) : boolean Checks if a session section exist and is not empty.
isStarted ( ) : boolean Has been session started?
regenerateId ( ) : void Regenerates the session ID.
setCookieParameters ( $path, $domain = NULL, $secure = NULL ) : self Sets the session cookie parameters.
setExpiration ( $time ) : self Sets the amount of time allowed between requests before the session will be terminated.
setHandler ( SessionHandlerInterface $handler ) : self Sets user session handler.
setName ( $name ) : self Sets the session name to a specified one.
setOptions ( array $options ) : self Sets session options.
setSavePath ( $path ) : self Sets path of the directory used to save session data.
setStorage ( Nette\Http\ISessionStorage $storage ) : self
start ( ) : void Starts and initializes session data.

Private Methods

Méthode Description
configure ( array $config ) : void Configures session environment.
sendCookie ( ) : void Sends the session cookies.

Method Details

__construct() public méthode

public __construct ( Nette\Http\IRequest $request, Nette\Http\IResponse $response )
$request Nette\Http\IRequest
$response Nette\Http\IResponse

clean() public méthode

Cleans and minimizes meta structures. This method is called automatically on shutdown, do not call it directly.
public clean ( ) : void
Résultat void

close() public méthode

Ends the current session and store session data.
public close ( ) : void
Résultat void

destroy() public méthode

Destroys all data registered to a session.
public destroy ( ) : void
Résultat void

exists() public méthode

Does session exists for the current request?
public exists ( ) : boolean
Résultat boolean

getCookieParameters() public méthode

Returns the session cookie parameters.
public getCookieParameters ( ) : array
Résultat array containing items: lifetime, path, domain, secure, httponly

getId() public méthode

Returns the current session ID. Don't make dependencies, can be changed for each request.
public getId ( ) : string
Résultat string

getIterator() public méthode

Iteration over all sections.
public getIterator ( ) : ArrayIterator
Résultat ArrayIterator

getName() public méthode

Gets the session name.
public getName ( ) : string
Résultat string

getOptions() public méthode

Returns all session options.
public getOptions ( ) : array
Résultat array

getSection() public méthode

Returns specified session section.
public getSection ( $section, $class = SessionSection::class ) : SessionSection
Résultat SessionSection

hasSection() public méthode

Checks if a session section exist and is not empty.
public hasSection ( $section ) : boolean
Résultat boolean

isStarted() public méthode

Has been session started?
public isStarted ( ) : boolean
Résultat boolean

regenerateId() public méthode

Regenerates the session ID.
public regenerateId ( ) : void
Résultat void

setCookieParameters() public méthode

Sets the session cookie parameters.
public setCookieParameters ( $path, $domain = NULL, $secure = NULL ) : self
Résultat self

setExpiration() public méthode

Sets the amount of time allowed between requests before the session will be terminated.
public setExpiration ( $time ) : self
Résultat self

setHandler() public méthode

Sets user session handler.
public setHandler ( SessionHandlerInterface $handler ) : self
$handler SessionHandlerInterface
Résultat self

setName() public méthode

Sets the session name to a specified one.
public setName ( $name ) : self
Résultat self

setOptions() public méthode

Sets session options.
public setOptions ( array $options ) : self
$options array
Résultat self

setSavePath() public méthode

Sets path of the directory used to save session data.
public setSavePath ( $path ) : self
Résultat self

setStorage() public méthode

Deprecation: use setHandler().
public setStorage ( Nette\Http\ISessionStorage $storage ) : self
$storage Nette\Http\ISessionStorage
Résultat self

start() public méthode

Starts and initializes session data.
public start ( ) : void
Résultat void