Elgg  Version 1.10
Public Member Functions | List of all members
Elgg\Http\SessionStorage Interface Reference
Inheritance diagram for Elgg\Http\SessionStorage:
Elgg\Http\MockSessionStorage Elgg\Http\NativeSessionStorage

Public Member Functions

 start ()
 Starts the session. More...
 
 isStarted ()
 Checks if the session is started. More...
 
 getId ()
 Returns the session ID. More...
 
 setId ($id)
 Sets the session ID. More...
 
 getName ()
 Returns the session name. More...
 
 setName ($name)
 Sets the session name. More...
 
 regenerate ($destroy=false, $lifetime=null)
 Regenerates id that represents this storage. More...
 
 save ()
 Force the session to be saved and closed. More...
 
 has ($name)
 Checks if an attribute is defined. More...
 
 get ($name, $default=null)
 Returns an attribute. More...
 
 set ($name, $value)
 Sets an attribute. More...
 
 all ()
 Returns all attributes. More...
 
 replace (array $attributes)
 Replaces all attributes. More...
 
 remove ($name)
 Removes an attribute. More...
 
 clear ()
 Clears all attributes. More...
 

Detailed Description

Definition at line 36 of file SessionStorage.php.

Member Function Documentation

Elgg\Http\SessionStorage::all ( )

Returns all attributes.

Returns
array Attributes

Implemented in Elgg\Http\NativeSessionStorage, and Elgg\Http\MockSessionStorage.

Elgg\Http\SessionStorage::clear ( )

Clears all attributes.

Returns
void

Implemented in Elgg\Http\NativeSessionStorage, and Elgg\Http\MockSessionStorage.

Elgg\Http\SessionStorage::get (   $name,
  $default = null 
)

Returns an attribute.

Parameters
string$nameThe attribute name
mixed$defaultThe default value if not found.
Returns
mixed

Implemented in Elgg\Http\NativeSessionStorage, and Elgg\Http\MockSessionStorage.

Elgg\Http\SessionStorage::getId ( )

Returns the session ID.

Returns
string The session ID or empty.

Implemented in Elgg\Http\NativeSessionStorage, and Elgg\Http\MockSessionStorage.

Elgg\Http\SessionStorage::getName ( )

Returns the session name.

Returns
string The session name.

Implemented in Elgg\Http\NativeSessionStorage, and Elgg\Http\MockSessionStorage.

Elgg\Http\SessionStorage::has (   $name)

Checks if an attribute is defined.

Parameters
string$nameThe attribute name
Returns
boolean

Implemented in Elgg\Http\NativeSessionStorage, and Elgg\Http\MockSessionStorage.

Elgg\Http\SessionStorage::isStarted ( )

Checks if the session is started.

Returns
boolean True if started, false otherwise.

Implemented in Elgg\Http\NativeSessionStorage, and Elgg\Http\MockSessionStorage.

Elgg\Http\SessionStorage::regenerate (   $destroy = false,
  $lifetime = null 
)

Regenerates id that represents this storage.

This method must invoke session_regenerate_id($destroy) unless this interface is used for a storage object designed for unit or functional testing where a real PHP session would interfere with testing.

Note regenerate+destroy should not clear the session data in memory only delete the session data from persistent storage.

Parameters
boolean$destroyDestroy session when regenerating?
integer$lifetimeSets the cookie lifetime for the session cookie. A null value will leave the system settings unchanged, 0 sets the cookie to expire with browser session. Time is in seconds, and is not a Unix timestamp.
Returns
boolean True if session regenerated, false if error
Exceptions

Implemented in Elgg\Http\NativeSessionStorage, and Elgg\Http\MockSessionStorage.

Elgg\Http\SessionStorage::remove (   $name)

Removes an attribute.

Parameters
string$nameAttribute name
Returns
mixed The removed value

Implemented in Elgg\Http\NativeSessionStorage, and Elgg\Http\MockSessionStorage.

Elgg\Http\SessionStorage::replace ( array  $attributes)

Replaces all attributes.

Parameters
array$attributesAttributes
Returns
void

Implemented in Elgg\Http\NativeSessionStorage, and Elgg\Http\MockSessionStorage.

Elgg\Http\SessionStorage::save ( )

Force the session to be saved and closed.

This method must invoke session_write_close() unless this interface is used for a storage object design for unit or functional testing where a real PHP session would interfere with testing, in which case it it should actually persist the session data if required.

Returns
void
Exceptions

Implemented in Elgg\Http\NativeSessionStorage, and Elgg\Http\MockSessionStorage.

Elgg\Http\SessionStorage::set (   $name,
  $value 
)

Sets an attribute.

Parameters
string$nameAttribute name
mixed$valueAttribute value
Returns
void

Implemented in Elgg\Http\NativeSessionStorage, and Elgg\Http\MockSessionStorage.

Elgg\Http\SessionStorage::setId (   $id)

Sets the session ID.

Parameters
string$idSession string
Returns
void

Implemented in Elgg\Http\NativeSessionStorage, and Elgg\Http\MockSessionStorage.

Elgg\Http\SessionStorage::setName (   $name)

Sets the session name.

Parameters
string$nameSession name.
Returns
void

Implemented in Elgg\Http\NativeSessionStorage, and Elgg\Http\MockSessionStorage.

Elgg\Http\SessionStorage::start ( )

Starts the session.

Returns
boolean True if started.
Exceptions

Implemented in Elgg\Http\NativeSessionStorage, and Elgg\Http\MockSessionStorage.


The documentation for this interface was generated from the following file: