Class myMVC_HttpSession

Description

Class to manage the sessions.

It supports normal session (managed from PHP) or database ones. Session-ID can be as URL-parameter or as Cookie. See mymvc.php for configuration items

Located in /myMVC/HttpSession.php (line 30)


	
			
Method Summary
 void __destruct ()
 void delete (string $key)
 void deleteFromNamespace (string $namespace, string $key)
 void destroy ()
 void emptyGivenNamespace (string $namespace)
 void emptyNamespace ()
 boolean exists (string $key)
 boolean existsInNamespace (string $namespace, string $key)
 object Value get (string $key)
 object Value getFromNamespace (string $namespace, string $key)
 string getSessionId ()
 boolean isExpired ()
 void set (string $key, object $value)
 void setInNamespace (string $namespace, string $key, object $value)
 void shutdown ()
 void startNewSession ()
 void useNamespace (string $namespace)
Methods
static getInstance (line 119)

Returns the instance of this class.

  • return: An instance of the session class
  • access: public
myMVC_HttpSession getInstance ()
Destructor __destruct (line 91)

Destructor.

Saves the data in the session or the database, depending on the value of $config['SESSION_TYPE'] (see mymvc.php)

  • access: public
void __destruct ()
delete (line 239)

Delete an object from current namespace

  • access: public
void delete (string $key)
  • string $key: Name of the variable
deleteFromNamespace (line 250)

Delete an object from the given namespace

  • access: public
void deleteFromNamespace (string $namespace, string $key)
  • string $namespace: Namespace to be used for deleting
  • string $key: Name of the variable
destroy (line 173)

Destroy the current Session (for example due to a logout) and starts a new one.

  • access: public
void destroy ()
emptyGivenNamespace (line 206)

Empty a given namespace

  • access: public
void emptyGivenNamespace (string $namespace)
  • string $namespace: Namespace to be deleted
emptyNamespace (line 196)

Empty the current used namespace

  • access: public
void emptyNamespace ()
exists (line 288)

Returns whether an object exists in the current namespace

  • return: true if exists, false otherwise
  • access: public
boolean exists (string $key)
  • string $key: Name of the variable
existsInNamespace (line 300)

Returns whether an object exists in the given namespace

  • return: true if exists, false otherwise
  • access: public
boolean existsInNamespace (string $namespace, string $key)
  • string $namespace: Namespace to be used for get
  • string $key: Name of the variable
get (line 261)

Returns a previously saved object in the current namespace

  • access: public
object Value get (string $key)
  • string $key: Name of the variable
getFromNamespace (line 275)

Returns a previously saved object in the given namespace

  • access: public
object Value getFromNamespace (string $namespace, string $key)
  • string $namespace: Namespace to be used for get
  • string $key: Name of the variable
getSessionId (line 164)

Returns the current session ID

  • return: The SessionID
  • access: public
string getSessionId ()
isExpired (line 154)

Returns if the current session is expired

  • return: true if the session is expired, false if it's active
  • access: public
boolean isExpired ()
set (line 217)

Save an object in the current namespace

  • access: public
void set (string $key, object $value)
  • string $key: Name of the variable
  • object $value: Object to be saved
setInNamespace (line 229)

Save an object in the given namespace

  • access: public
void setInNamespace (string $namespace, string $key, object $value)
  • string $namespace: Namespace to be used for saving
  • string $key: Name of the variable
  • object $value: Object to be saved
shutdown (line 107)

Called from PHP if the script terminates with exit()

  • access: public
void shutdown ()
startNewSession (line 135)

Starts a new session.

Lifetime in seconds and type (URL or Cookies) can be set in the configuration ($config['SESSION_LIFETIME'] and $config['SESSION_USECOOKIES']). Default are 8 hours for lifetime and URL for session

  • access: protected
void startNewSession ()
useNamespace (line 188)

Set the namespace to use

  • access: public
void useNamespace (string $namespace)
  • string $namespace: The namespace to be used

Documentation generated on Wed, 09 Mar 2016 21:27:02 +0100 by phpDocumentor 1.4.4