Class Session (namespace Nette\Web)


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

Object
   |
   --Session
Copyright: Copyright (c) 2004, 2010 David Grudl
Located: in /Web/Session.php (line 21)
Public Method Summary
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?
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 (string|int|DateTime $time)
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 24

Default file lifetime is 3 hours
Variable Summary
mixed $verificationKeyGenerator

line 27


Method Details

line 334

clean

public void clean ()

Cleans and minimizes meta structures.

Output
void  

line 164

close

public void close ()

Ends the current session and store session data.

Output
void  

line 179

destroy

public void destroy ()

Destroys all data registered to a session.

Output
void  

line 200

exists

public bool exists ()

Does session exists for the current request?

Output
bool  

line 496

getCookieParams

public array getCookieParams ()

Returns the session cookie parameters.

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

line 536

getHttpRequest

protected IHttpRequest getHttpRequest ()

Output
IHttpRequest  

line 546

getHttpResponse

protected IHttpResponse getHttpResponse ()

Output
IHttpResponse  

line 231

getId

public string getId ()

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

Output
string  

line 314

getIterator

public ArrayIterator getIterator ()

Iteration over all namespaces.

Output
ArrayIterator  

line 261

getName

public string getName ()

Gets the session name.

Output
string  

line 279

getNamespace

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

Returns specified session namespace.

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

line 390

getOptions

public array getOptions ()

Returns all session options.

Output
array  

line 299

hasNamespace

public bool hasNamespace (string $namespace)

Checks if a session namespace exist and is not empty.

Input
string $namespace
Output
bool  

line 153

isStarted

public bool isStarted ()

Has been session started?

Output
bool  

line 212

regenerateId

public void regenerateId ()

Regenerates the session ID.

Output
void  
Throws
throws InvalidStateException

line 481

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 455

setExpiration

public Session setExpiration (string|int|DateTime $time)

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

Input
string|int|DateTime $time time, value 0 means "until the browser is closed"
Output
Session provides a fluent interface

line 243

setName

public Session setName (string $name)

Sets the session name to a specified one.

Input
string $name
Output
Session provides a fluent interface

line 375

setOptions

public Session setOptions ($options)

Sets session options.

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

line 507

setSavePath

public Session setSavePath ($path)

Sets path of the directory used to save session data.

Input
$path
Output
Session provides a fluent interface

line 65

start

public void start ()

Starts and initializes session data.

Output
void  
Throws
throws InvalidStateException