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
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.
array
Returns all session options.
bool
hasNamespace (string $namespace)
Checks if a session namespace exist and is not empty.
bool
Has been session started?
void
Regenerates the session ID.
Session
setCookieParams (string $path, [string $domain = NULL], [bool $secure = NULL])
Sets the session cookie parameters.
Session
setExpiration (mixed $seconds)
Sets the amount of time allowed between requests before the session will be terminated.
Session
setName (string $name)
Sets the session name to a specified one.
Session
setOptions ($options)
Sets session options.
Session
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 393

clean

public void clean ()

Cleans and minimizes meta structures.

Output
void  

line 205

close

public void close ()

Ends the current session and store session data.

Output
void  

line 219

destroy

public void destroy ()

Destroys all data registered to a session.

Output
void  

line 240

exists

public bool exists ()

Does session exists for the current request?

Output
bool  

line 312

generateVerificationKey

public string generateVerificationKey ()

Generates key as protection against Session Hijacking & Fixation.

Output
string  

line 564

getCookieParams

public array getCookieParams ()

Returns the session cookie parameters.

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

line 604

getHttpRequest

protected IHttpRequest getHttpRequest ()

Output
IHttpRequest  

line 614

getHttpResponse

protected IHttpResponse getHttpResponse ()

Output
IHttpResponse  

line 271

getId

public string getId ()

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

Output
string  

line 373

getIterator

public ArrayIterator getIterator ()

Iteration over all namespaces.

Output
ArrayIterator  

line 301

getName

public string getName ()

Gets the session name.

Output
string  

line 338

getNamespace

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

Returns specified session namespace.

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

line 452

getOptions

public array getOptions ()

Returns all session options.

Output
array  

line 358

hasNamespace

public bool hasNamespace (string $namespace)

Checks if a session namespace exist and is not empty.

Input
string $namespace
Output
bool  

line 194

isStarted

public bool isStarted ()

Has been session started?

Output
bool  

line 252

regenerateId

public void regenerateId ()

Regenerates the session ID.

Output
void  
Throws
throws InvalidStateException

line 549

setCookieParams

public Session 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
Session provides a fluent interface

line 517

setExpiration

public Session 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
Session provides a fluent interface

line 283

setName

public Session setName (string $name)

Sets the session name to a specified one.

Input
string $name
Output
Session provides a fluent interface

line 437

setOptions

public Session setOptions ($options)

Sets session options.

Input
$options
Output
Session provides a fluent interface
Throws
throws InvalidStateException
throws NotSupportedException

line 575

setSavePath

public Session setSavePath ($path)

Sets path of the directory used to save session data.

Input
$path
Output
Session provides a fluent interface

line 84

start

public void start ()

Starts and initializes session data.

Output
void  
Throws
throws InvalidStateException