Ubiquity  2.0.3
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 setTmp ($key, $value, $duration)
 
static getTmp ($key, $default=null)
 
static getTimeout ($key)
 
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 init ($key, $value)
 Initialize the key in Session if key does not exists. 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 14 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 46 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 82 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 248 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 237 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 226 of file USession.php.

◆ delete()

static delete (   $key)
static

Deletes the key in Session.

Parameters
string$keythe key to delete

Definition at line 203 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 329 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 139 of file USession.php.

◆ getAll()

static getAll ( )
static

Returns the associative array of session vars.

Returns
array

Definition at line 290 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 24 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 107 of file USession.php.

◆ getTimeout()

static getTimeout (   $key)
static

Definition at line 182 of file USession.php.

◆ getTmp()

static getTmp (   $key,
  $default = null 
)
static

Definition at line 167 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 215 of file USession.php.

◆ init()

static init (   $key,
  $value 
)
static

Initialize the key in Session if key does not exists.

Parameters
string$key
mixed$value
Returns
mixed

Definition at line 340 of file USession.php.

◆ isStarted()

static isStarted ( )
static

Returns true if the session is started.

Returns
boolean

Definition at line 318 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 69 of file USession.php.

◆ replace()

static replace (   $keyAndValues)
static

Replaces elements from Session array with $keyAndValues.

Parameters
array$keyAndValues
Returns
array

Definition at line 279 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 125 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 151 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 95 of file USession.php.

◆ setTmp()

static setTmp (   $key,
  $value,
  $duration 
)
static

Definition at line 156 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 301 of file USession.php.

◆ terminate()

static terminate ( )
static

Terminates the active session.

Definition at line 350 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 267 of file USession.php.

Field Documentation

◆ $name

$name
staticprivate

Definition at line 15 of file USession.php.


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