Elgg  Version 1.9
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 34 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
RuntimeExceptionIf an error occurs while regenerating this storage

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
RuntimeExceptionIf the session is saved without being started, or if the session is already closed.

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
RuntimeExceptionIf something goes wrong starting the session.

Implemented in Elgg_Http_NativeSessionStorage, and Elgg_Http_MockSessionStorage.


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