UNA
BxDolKey Class Reference
Inheritance diagram for BxDolKey:
BxDolFactory iBxDolSingleton

Public Member Functions

 __clone ()
 
 getNewKey ($aData=false, $iExpire=604800, $sSalt='')
 
 getNewKeyNumeric ($aData=false, $iExpire=604800)
 
 isKeyExists ($sKey, $sSalt='')
 
 getKeyData ($sKey, $sSalt='')
 
 removeKey ($sKey)
 
 prune ()
 

Static Public Member Functions

static getInstance ()
 

Protected Member Functions

 __construct ()
 

Detailed Description

Key objects - automatically generate hashed keys.

Example of usage

Generate new hashed key:

$oKeys = BxDolKey::getInstance(); // get object instance
if ($oKeys) // check if object is available for using
echo $oKeys->getNewKey (false, 3600); // get new hashed key, which will be automatically deleted after 1 hour

Check if hashed key exists:

$oKeys = BxDolKey::getInstance(); // get object instance
if ($oKeys && $oKeys->isKeyExists ($sKey)) // check key exists
echo 'key exists';
else
echo 'key is invalid';

Constructor & Destructor Documentation

◆ __construct()

BxDolKey::__construct ( )
protected

Constructor

Member Function Documentation

◆ __clone()

BxDolKey::__clone ( )

Prevent cloning the instance

◆ getInstance()

static BxDolKey::getInstance ( )
static

Get singleton instance of the class

Implements iBxDolSingleton.

◆ getKeyData()

BxDolKey::getKeyData (   $sKey,
  $sSalt = '' 
)

Get key data.

Parameters
$sKey- key string
Returns
true if key exists or false if key is missing

◆ getNewKey()

BxDolKey::getNewKey (   $aData = false,
  $iExpire = 604800,
  $sSalt = '' 
)

Get new key.

Parameters
$aData- some data to associate with the key
$iExpire- number of seconds to generated key after, by default - 1 week
Returns
newly generated key string

◆ getNewKeyNumeric()

BxDolKey::getNewKeyNumeric (   $aData = false,
  $iExpire = 604800 
)

Get new key (numeric).

Parameters
$aData- some data to associate with the key
$iExpire- number of seconds to generated key after, by default - 1 week
Returns
newly generated key string

◆ isKeyExists()

BxDolKey::isKeyExists (   $sKey,
  $sSalt = '' 
)

Check if provided key exists.

Parameters
$sKey- key string
Returns
true if key exists or false if key is missing

◆ prune()

BxDolKey::prune ( )

Delete expired keys.

◆ removeKey()

BxDolKey::removeKey (   $sKey)

Delete provided key.

Parameters
$sKey- key string
Returns
true if key was successfully found and delete if false otherwise

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