Ubiquity  2.0.2
php rapid development framework
USession Class Reference

Http Session utilities. More...

Static Public Member Functions

static getArray ($arrayKey)
 Returns an array stored in session variable as $arrayKey. More...
 
static addOrRemoveValueFromArray ($arrayKey, $value, $add=true)
 Adds or removes a value from an array in session. More...
 
static removeValueFromArray ($arrayKey, $value)
 Removes a value from an array in session. More...
 
static addValueToArray ($arrayKey, $value)
 Adds a value from an array in session. More...
 
static setBoolean ($key, $value)
 Sets a boolean value at key position in session. More...
 
static getBoolean ($key)
 Returns a boolean stored at the key position in session. More...
 
static session ($key, $default=NULL)
 Returns the value stored at the key position in session. More...
 
static get ($key, $default=NULL)
 Returns the value stored at the key position in session. More...
 
static set ($key, $value)
 Adds or sets a value to the Session at position $key. More...
 
static delete ($key)
 Deletes the key in Session. More...
 
static inc ($key, $inc=1)
 Increment the value at the key index in session. More...
 
static dec ($key, $dec=1)
 Decrement the value at the key index in session. More...
 
static concat ($key, $str, $default=NULL)
 Adds a string at the end of the value at the key index in session. More...
 
static apply ($key, $callback, $default=NULL)
 Applies a callback function to the value at the key index in session. More...
 
static Walk ($callback, $userData=null)
 Apply a user supplied function to every member of Session array. More...
 
static replace ($keyAndValues)
 Replaces elements from Session array with $keyAndValues. More...
 
static getAll ()
 Returns the associative array of session vars. More...
 
static start ($name=null)
 Start new or resume existing session. More...
 
static isStarted ()
 Returns true if the session is started. More...
 
static exists ($key)
 Returns true if the key exists in Session. More...
 
static terminate ()
 Terminates the active session. More...
 

Static Private Attributes

static $name
 

Detailed Description

Http Session utilities.

Author
jc
Version
1.0.0.4

Definition at line 13 of file USession.php.

Member Function Documentation

◆ addOrRemoveValueFromArray()

static addOrRemoveValueFromArray (   $arrayKey,
  $value,
  $add = true 
)
static

Adds or removes a value from an array in session.

Parameters
string$arrayKeythe key of the array to add or remove in
mixed$valuethe value to add
boolean$addIf true, adds otherwise removes
Returns
boolean

Definition at line 45 of file USession.php.

◆ addValueToArray()

static addValueToArray (   $arrayKey,
  $value 
)
static

Adds a value from an array in session.

Parameters
string$arrayKeythe key of the array to add in
mixed$valuethe value to add
Returns
boolean

Definition at line 81 of file USession.php.

◆ apply()

static apply (   $key,
  $callback,
  $default = NULL 
)
static

Applies a callback function to the value at the key index in session.

Parameters
string$key
string | callable$callback
Returns
mixed

Definition at line 206 of file USession.php.

◆ concat()

static concat (   $key,
  $str,
  $default = NULL 
)
static

Adds a string at the end of the value at the key index in session.

Parameters
string$key
string$str
Returns
string

Definition at line 195 of file USession.php.

◆ dec()

static dec (   $key,
  $dec = 1 
)
static

Decrement the value at the key index in session.

Parameters
string$key
number$dec
Returns
number

Definition at line 184 of file USession.php.

◆ delete()

static delete (   $key)
static

Deletes the key in Session.

Parameters
string$keythe key to delete

Definition at line 161 of file USession.php.

◆ exists()

static exists (   $key)
static

Returns true if the key exists in Session.

Parameters
string$keythe key to test
Returns
boolean

Definition at line 287 of file USession.php.

◆ get()

static get (   $key,
  $default = NULL 
)
static

Returns the value stored at the key position in session.

Parameters
string$keythe key to retreive
mixed$defaultthe default value to return if the key does not exists in session
Returns
mixed

Definition at line 138 of file USession.php.

◆ getAll()

static getAll ( )
static

Returns the associative array of session vars.

Returns
array

Definition at line 248 of file USession.php.

◆ getArray()

static getArray (   $arrayKey)
static

Returns an array stored in session variable as $arrayKey.

Parameters
string$arrayKeythe key of the array to return
Returns
array

Definition at line 23 of file USession.php.

◆ getBoolean()

static getBoolean (   $key)
static

Returns a boolean stored at the key position in session.

Parameters
string$keythe key to add or set
Returns
boolean

Definition at line 106 of file USession.php.

◆ inc()

static inc (   $key,
  $inc = 1 
)
static

Increment the value at the key index in session.

Parameters
string$key
number$inc
Returns
number

Definition at line 173 of file USession.php.

◆ isStarted()

static isStarted ( )
static

Returns true if the session is started.

Returns
boolean

Definition at line 276 of file USession.php.

◆ removeValueFromArray()

static removeValueFromArray (   $arrayKey,
  $value 
)
static

Removes a value from an array in session.

Parameters
string$arrayKeythe key of the array to remove in
mixed$valuethe value to remove
Returns
boolean

Definition at line 68 of file USession.php.

◆ replace()

static replace (   $keyAndValues)
static

Replaces elements from Session array with $keyAndValues.

Parameters
array$keyAndValues
Returns
array

Definition at line 237 of file USession.php.

◆ session()

static session (   $key,
  $default = NULL 
)
static

Returns the value stored at the key position in session.

Parameters
string$keythe key to retreive
mixed$defaultthe default value to return if the key does not exists in session
Returns
mixed

Definition at line 124 of file USession.php.

◆ set()

static set (   $key,
  $value 
)
static

Adds or sets a value to the Session at position $key.

Parameters
string$keythe key to add or set
mixed$value

Definition at line 150 of file USession.php.

◆ setBoolean()

static setBoolean (   $key,
  $value 
)
static

Sets a boolean value at key position in session.

Parameters
string$keythe key to add or set in
mixed$valuethe value to set
Returns
boolean

Definition at line 94 of file USession.php.

◆ start()

static start (   $name = null)
static

Start new or resume existing session.

Parameters
string | null$namethe name of the session

Definition at line 259 of file USession.php.

◆ terminate()

static terminate ( )
static

Terminates the active session.

Definition at line 295 of file USession.php.

◆ Walk()

static Walk (   $callback,
  $userData = null 
)
static

Apply a user supplied function to every member of Session array.

Parameters
callable$callback
mixed$userData
Returns
array

Definition at line 225 of file USession.php.

Field Documentation

◆ $name

$name
staticprivate

Definition at line 14 of file USession.php.


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