AnewtSession class

The session class provides several static methods for session handling.

Class Overview

The session class provides several static methods for session handling.

Methods to start and destroy sessions

These methods will setup and teardown user sessions.

static init($name, $timeout=null) [static]

Initialize the session with the given name.

Parameters

$name

The name this session should have.

$timeout

The timeout value for this session.

static destroy() [static]

Destroy the current session.

Methods for handling session data

These methods can be used to get and set session data.

static set($name, $value) [static]

Store a variable in the session.

Parameters

$name

The variable name.

$value

The value of the variable.

static get($name) [static]

Obtain a value from the session.

If no value was set for the provided name, an error is thrown.

Parameters

$name

The variable name.

Return value

The value of the variable.

static delete($name) [static]

Deletes a variable from the session.

If no value was set for the provided name, an error is thrown.

Parameters

$name

The name of the variable to delete.

Return value

The value of deleted variable.

static is_set($name) [static]

Checks if a variable is defined in the session.

Parameters

$name

The variable name to check for.

Return value

True if the variable is available, false otherwise.