Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
USession Class Reference

Http Session utilities This class is part of Ubiquity. More...

Static Public Member Functions

static getArray (string $arrayKey)
 Returns an array stored in session variable as $arrayKey.
 
static addOrRemoveValueFromArray (string $arrayKey, $value, $add=null)
 Adds or removes a value from an array in session.
 
static removeValueFromArray (string $arrayKey, $value)
 Removes a value from an array in session.
 
static addValueToArray (string $arrayKey, $value)
 Adds a value from an array in session.
 
static setBoolean (string $key, $value)
 Sets a boolean value at key position in session.
 
static getBoolean (string $key)
 Returns a boolean stored at the key position in session.
 
static session (string $key, $default=NULL)
 Returns the value stored at the key position in session.
 
static get (string $key, $default=NULL)
 Returns the value stored at the key position in session.
 
static set (string $key, $value)
 Adds or sets a value to the Session at position $key.
 
static setTmp (string $key, $value, $duration)
 
static getTmp (string $key, $default=null)
 
static getTimeout (string $key)
 
static delete (string $key)
 Deletes the key in Session.
 
static inc (string $key, int $inc=1)
 Increment the value at the key index in session.
 
static dec (string $key, int $dec=1)
 Decrement the value at the key index in session.
 
static concat (string $key, string $str, string $default=NULL)
 Adds a string at the end of the value at the key index in session.
 
static apply (string $key, $callback, $default=NULL)
 Applies a callback function to the value at the key index in session.
 
static Walk ($callback, $userData=null)
 Apply a user supplied function to every member of Session array.
 
static replace (array $keyAndValues)
 Replaces elements from Session array with $keyAndValues.
 
static getAll ()
 Returns the associative array of session vars.
 
static start ($name=null)
 Start new or resume existing session.
 
static isStarted ()
 Returns true if the session is started.
 
static exists (string $key)
 Returns true if the key exists in Session.
 
static init (string $key, $value)
 Initialize the key in Session if key does not exists.
 
static terminate ()
 Terminates the active session.
 
static getCsrfProtectionClass ()
 Return the Csrf protection class name.
 
static getInstanceClass ()
 Return the instance class name for the session.
 
static visitorCount ()
 Returns the number of sessions started.
 
static regenerateId (bool $deleteOldSession=false)
 Re-generates the session id.
 

Static Protected Attributes

static $sessionInstance
 

Detailed Description

Http Session utilities This class is part of Ubiquity.

Author
jcheron myadd.nosp@m.ress.nosp@m.mail@.nosp@m.gmai.nosp@m.l.com
Version
1.1.4

Definition at line 16 of file USession.php.

Member Function Documentation

◆ addOrRemoveValueFromArray()

static addOrRemoveValueFromArray ( string  $arrayKey,
  $value,
  $add = null 
)
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 | null$addIf true, adds otherwise removes
Returns
boolean|null

Definition at line 43 of file USession.php.

◆ addValueToArray()

static addValueToArray ( string  $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|null

Definition at line 77 of file USession.php.

◆ apply()

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

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

Parameters
string$key
string | callable$callback
mixed$default
Returns
mixed

Definition at line 229 of file USession.php.

◆ concat()

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

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

Parameters
string$key
string$str
?string$default
Returns
string

Definition at line 217 of file USession.php.

◆ dec()

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

Decrement the value at the key index in session.

Parameters
string$key
int$dec
Returns
number

Definition at line 205 of file USession.php.

◆ delete()

static delete ( string  $key)
static

Deletes the key in Session.

Parameters
string$keythe key to delete

Definition at line 183 of file USession.php.

◆ exists()

static exists ( string  $key)
static

Returns true if the key exists in Session.

Parameters
string$keythe key to test
Returns
boolean

Definition at line 305 of file USession.php.

◆ get()

static get ( string  $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 121 of file USession.php.

◆ getAll()

static getAll ( )
static

Returns the associative array of session vars.

Returns
array

Definition at line 274 of file USession.php.

◆ getArray()

static getArray ( string  $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 25 of file USession.php.

◆ getBoolean()

static getBoolean ( string  $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 98 of file USession.php.

◆ getCsrfProtectionClass()

static getCsrfProtectionClass ( )
static

Return the Csrf protection class name.

Returns
string

Definition at line 335 of file USession.php.

◆ getInstanceClass()

static getInstanceClass ( )
static

Return the instance class name for the session.

Returns
string

Definition at line 346 of file USession.php.

◆ getTimeout()

static getTimeout ( string  $key)
static

Definition at line 163 of file USession.php.

◆ getTmp()

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

Definition at line 147 of file USession.php.

◆ inc()

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

Increment the value at the key index in session.

Parameters
string$key
int$inc
Returns
number

Definition at line 194 of file USession.php.

◆ init()

static init ( string  $key,
  $value 
)
static

Initialize the key in Session if key does not exists.

Parameters
string$key
mixed$value
Returns
mixed

Definition at line 316 of file USession.php.

◆ isStarted()

static isStarted ( )
static

Returns true if the session is started.

Returns
boolean

Definition at line 295 of file USession.php.

◆ regenerateId()

static regenerateId ( bool  $deleteOldSession = false)
static

Re-generates the session id.

Parameters
boolean$deleteOldSessionif true, deletes the old session
Returns
bool

Definition at line 366 of file USession.php.

◆ removeValueFromArray()

static removeValueFromArray ( string  $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|null

Definition at line 66 of file USession.php.

◆ replace()

static replace ( array  $keyAndValues)
static

Replaces elements from Session array with $keyAndValues.

Parameters
array$keyAndValues
Returns
array

Definition at line 262 of file USession.php.

◆ session()

static session ( string  $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 110 of file USession.php.

◆ set()

static set ( string  $key,
  $value 
)
static

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

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

Definition at line 132 of file USession.php.

◆ setBoolean()

static setBoolean ( string  $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 88 of file USession.php.

◆ setTmp()

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

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

◆ terminate()

static terminate ( )
static

Terminates the active session.

Definition at line 326 of file USession.php.

◆ visitorCount()

static visitorCount ( )
static

Returns the number of sessions started.

Returns
number

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

Field Documentation

◆ $sessionInstance

$sessionInstance
staticprotected

Definition at line 17 of file USession.php.


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