\Lobby\AppsData

Manage data stored by app

Summary

Methods
Properties
Constants
__construct()
saveValue()
getValue()
getValues()
remove()
getArray()
saveArray()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$app
$dbh
$dbPrefix
N/A

Properties

$app

$app : \Lobby\Apps\Lobby\App

Type

\Lobby\Apps\Lobby\App — Object of app running this

$dbh

$dbh : \PDO

Type

\PDO — Database Handler

$dbPrefix

$dbPrefix : string

Type

string — The prefix of table names

Methods

__construct()

__construct(\Lobby\App  $App) 

Initialize

Parameters

\Lobby\App $App

App object

saveValue()

saveValue(string  $key, string  $value) : boolean

Save a key-value pair

Parameters

string $key

Key by which data will be accessed

string $value

Data to save

Returns

boolean —

Whether operation is successful

getValue()

getValue(\Lobby\Apps\[type]  $key, boolean  $meta = false) : string|array

Get a value associated with key

Parameters

\Lobby\Apps\[type] $key

Key

boolean $meta

Whether meta data should be included in return value. If this is set to true, the return value would be an array

Returns

string|array —

Value or Value + metadata. Meta data would include the value created and updated timestamp.

getValues()

getValues() : array

Get all values stored by app

Returns

array —

Values along with metadata

remove()

remove(string  $key) : boolean

Remove a key-value pair

Parameters

string $key

Key to remove

Returns

boolean —

Whether data was removed

getArray()

getArray(string  $key) : array

Get stored array value

Parameters

string $key

Key

Returns

array —

The array data saved

saveArray()

saveArray(string  $key, array  $value) : boolean

Save an array

Parameters

string $key

Key

array $value

Array of data to save. To remove an item in array, set the value of it to boolean FALSE.

Returns

boolean —

Whether array is saved