Class Session (namespace Nette\Web)


Provides access to session namespaces as well as session settings and management methods.

Object
   |
   --Session
Author: David Grudl
Copyright: Copyright (c) 2004, 2009 David Grudl
Located: in /Web/Session.php (line 33)
Public Method Summary
Session
void
clean ()
Cleans and minimizes meta structures.
void
close ()
Ends the current session and store session data.
void
configure ($config, [bool $throwException = TRUE])
Configurates session environment.
void
destroy ()
Destroys all data registered to a session.
bool
exists ()
Does session exists for the current request?
string
Generates key as protection against Session Hijacking & Fixation.
array
Returns the session cookie parameters.
string
getId ()
Returns the current session ID. Don't make dependencies, can be changed for each request.
ArrayIterator
Iteration over all namespaces.
string
getName ()
Gets the session name.
SessionNamespace
getNamespace (string $namespace, [string $class = 'SessionNamespace'])
Returns specified session namespace.
bool
hasNamespace (string $namespace)
Checks if a session namespace exist and is not empty.
bool
Has been session started?
void
Regenerates the session ID.
void
setCookieParams (string $path, [string $domain = NULL], [bool $secure = NULL])
Sets the session cookie parameters.
void
setExpiration (mixed $seconds)
Sets the amount of time allowed between requests before the session will be terminated.
void
setName (string $name)
Sets the session name to a specified one.
void
setSavePath ($path)
Sets path of the directory used to save session data.
void
start ()
Starts and initializes session data.
Protected Method Summary
protected IHttpRequest
protected IHttpResponse
Methods Inherited From Object
extensionMethod(), getClass(), getReflection(), __call(), __callStatic(), __get(), __isset(), __set(), __unset()
Constant Summary
int DEFAULT_FILE_LIFETIME 10800

line 36

Default file lifetime is 3 hours
Variable Summary
callback $verificationKeyGenerator

line 39

Validation key generator

Method Details

line 72

__construct

public Session __construct ()

Output
Session  

line 387

clean

public void clean ()

Cleans and minimizes meta structures.

Output
void  

line 201

close

public void close ()

Ends the current session and store session data.

Output
void  

line 432

configure

public void configure ($config, [bool $throwException = TRUE])

Configurates session environment.

Input
$config
bool $throwException throw exception?
Output
void  
Throws
throws InvalidStateException
throws NotSupportedException

line 215

destroy

public void destroy ()

Destroys all data registered to a session.

Output
void  

line 236

exists

public bool exists ()

Does session exists for the current request?

Output
bool  

line 308

generateVerificationKey

public string generateVerificationKey ()

Generates key as protection against Session Hijacking & Fixation.

Output
string  

line 531

getCookieParams

public array getCookieParams ()

Returns the session cookie parameters.

Output
array containing items: lifetime, path, domain, secure, httponly

line 571

getHttpRequest

protected IHttpRequest getHttpRequest ()

Output
IHttpRequest  

line 581

getHttpResponse

protected IHttpResponse getHttpResponse ()

Output
IHttpResponse  

line 268

getId

public string getId ()

Returns the current session ID. Don't make dependencies, can be changed for each request.

Output
string  

line 367

getIterator

public ArrayIterator getIterator ()

Iteration over all namespaces.

Output
ArrayIterator  

line 297

getName

public string getName ()

Gets the session name.

Output
string  

line 332

getNamespace

public SessionNamespace getNamespace (string $namespace, [string $class = 'SessionNamespace'])

Returns specified session namespace.

Input
string $namespace
string $class
Output
SessionNamespace  
Throws
throws InvalidArgumentException

line 352

hasNamespace

public bool hasNamespace (string $namespace)

Checks if a session namespace exist and is not empty.

Input
string $namespace
Output
bool  

line 190

isStarted

public bool isStarted ()

Has been session started?

Output
bool  

line 248

regenerateId

public void regenerateId ()

Regenerates the session ID.

Output
void  
Throws
throws InvalidStateException

line 516

setCookieParams

public void setCookieParams (string $path, [string $domain = NULL], [bool $secure = NULL])

Sets the session cookie parameters.

Input
string $path path
string $domain domain
bool $secure secure
Output
void  

line 484

setExpiration

public void setExpiration (mixed $seconds)

Sets the amount of time allowed between requests before the session will be terminated.

Input
mixed $seconds number of seconds, value 0 means "until the browser is closed"
Output
void  

line 280

setName

public void setName (string $name)

Sets the session name to a specified one.

Input
string $name
Output
void  

line 542

setSavePath

public void setSavePath ($path)

Sets path of the directory used to save session data.

Input
$path
Output
void  

line 84

start

public void start ()

Starts and initializes session data.

Output
void  
Throws
throws InvalidStateException