Class flVariables
flVariables Class
Class to provide persistent storage to variables using a database.
-
flVariables
implements
Iterator,
Countable
Package: fusionLib
Copyright:
Copyright (c) 2012 - 2013 fusionLib. All rights reserved.
Located at system/libs/Variables/flVariables.php
Methods summary
public
|
#
__construct( string $namespace, flDb $db )
Construct a new configuration object.
Construct a new configuration object.
Parameters
- $namespace
- Name of the variable data to load.
- $db
- The database to use to read the data.
|
public
|
#
deleteNamespace( )
Delete all the data items in the namespace.
Delete all the data items in the namespace.
|
public
string
|
#
getNamespace( )
Return the namespace for the data.
Return the namespace for the data.
Returns
string The namespace.
|
public
|
#
__set( string $key, mixed $value )
Set the value of an item.
Set the value of an item.
Parameters
- $key
- The name of the item to set.
- $value
- The value to set for the item.
|
public
boolean
|
#
setIfNotChanged( string $key, mixed $value )
Set the value of an item only if the value in the database is the same as the loaded value.
Set the value of an item only if the value in the database is the same as the loaded value.
Parameters
- $key
- The name of the item to set.
- $value
- The value to set for the item.
Returns
boolean true if the value was updated, else false.
|
public
|
#
__unset( string $key )
Unset an item.
Parameters
- $key
- The name of the item to unset.
|
public
mixed
|
#
get( string $key, mixed $default = null )
Get an item.
If the items is not present then the default value is returned.
Parameters
- $key
- The name of the item to get.
- $default
- The default value to use if the item is not present.
Returns
mixed The value assigned to the key or the default value.
|
public
mixed
|
#
__get( string $key )
Read an item value.
If the value is not present then an error is reported and the function never returns.
Parameters
- $key
- The name of the item to get.
Returns
mixed The value assigned to the item.
Throws
|
public
boolean
|
#
__isset( string $name )
Test if a variable is set.
Test if a variable is set.
Parameters
- $name
- The name of the key to test for.
Returns
boolean True if the key is present; else false.
|
public
integer
|
#
count( )
Number of items.
Returns
integer The number of items.
Implementation of
Countable::count()
|
public
mixed
|
#
next( )
Move to the next item.
Returns
mixed The item value.
Implementation of
Iterator::next()
|
public
mixed
|
#
rewind( )
Move to the first item.
Returns
mixed The value of the first item.
Implementation of
Iterator::rewind()
|
public
mixed
|
#
key( )
Fetch the key.
Returns
mixed The key.
Implementation of
Iterator::key()
|
public
mixed
|
#
current( )
The current item.
Returns
mixed The current item value.
Implementation of
Iterator::current()
|
public
boolean
|
#
valid( )
Test if the array pointer is valid.
Test if the array pointer is valid.
Returns
boolean true if the position in the array is valid; else false.
Implementation of
Iterator::valid()
|
Properties summary
protected
array
|
$data
|
|
protected
string
|
$namespace
|
|
protected
flDb
|
$db
|
|