PHP Class Flintstone\Flintstone

Mostrar archivo Open project: fire015/flintstone Class Usage Examples

Protected Properties

Property Type Description
$config Config Config class.
$database Database Database class.

Public Methods

Method Description
__construct ( Database | string $database, Config | array $config ) Constructor.
delete ( string $key ) Delete a key from the database.
flush ( ) Flush the database.
get ( string $key ) : mixed Get a key from the database.
getAll ( ) : array Get all data from the database.
getConfig ( ) : Config Get the config.
getDatabase ( ) : Database Get the database.
getKeys ( ) : array Get all keys from the database.
set ( string $key, mixed $data ) Set a key in the database.
setConfig ( Config $config ) Set the config.
setDatabase ( Database $database ) Set the database.

Protected Methods

Method Description
decodeData ( string $data ) : mixed Decode a string into data.
encodeData ( mixed $data ) : string Encode data into a string.
getDataFromLine ( string $line, string $key ) : string | boolean Retrieve data from a given line for a specific key.
getKeyFromLine ( string $line ) : string Retrieve key from a given line.
getLinePieces ( string $line ) : array Retrieve the pieces from a given line.
getLineString ( string $key, mixed $data ) : string Get the line string to write.
replace ( string $key, mixed $data ) Replace a key in the database.
validateData ( mixed $data ) Check the data type is valid.
validateKey ( string $key ) Validate the key.

Method Details

__construct() public method

Constructor.
public __construct ( Database | string $database, Config | array $config )
$database Database | string
$config Config | array

decodeData() protected method

Decode a string into data.
protected decodeData ( string $data ) : mixed
$data string
return mixed

delete() public method

Delete a key from the database.
public delete ( string $key )
$key string

encodeData() protected method

Encode data into a string.
protected encodeData ( mixed $data ) : string
$data mixed
return string

flush() public method

Flush the database.
public flush ( )

get() public method

Get a key from the database.
public get ( string $key ) : mixed
$key string
return mixed

getAll() public method

Get all data from the database.
public getAll ( ) : array
return array

getConfig() public method

Get the config.
public getConfig ( ) : Config
return Config

getDataFromLine() protected method

Retrieve data from a given line for a specific key.
protected getDataFromLine ( string $line, string $key ) : string | boolean
$line string
$key string
return string | boolean

getDatabase() public method

Get the database.
public getDatabase ( ) : Database
return Database

getKeyFromLine() protected method

Retrieve key from a given line.
protected getKeyFromLine ( string $line ) : string
$line string
return string

getKeys() public method

Get all keys from the database.
public getKeys ( ) : array
return array

getLinePieces() protected method

Retrieve the pieces from a given line.
protected getLinePieces ( string $line ) : array
$line string
return array

getLineString() protected method

Get the line string to write.
protected getLineString ( string $key, mixed $data ) : string
$key string
$data mixed
return string

replace() protected method

Replace a key in the database.
protected replace ( string $key, mixed $data )
$key string
$data mixed

set() public method

Set a key in the database.
public set ( string $key, mixed $data )
$key string
$data mixed

setConfig() public method

Set the config.
public setConfig ( Config $config )
$config Config

setDatabase() public method

Set the database.
public setDatabase ( Database $database )
$database Database

validateData() protected method

Check the data type is valid.
protected validateData ( mixed $data )
$data mixed the data

validateKey() protected method

Validate the key.
protected validateKey ( string $key )
$key string

Property Details

$config protected_oe property

Config class.
protected Config,flintstone $config
return Config

$database protected_oe property

Database class.
protected Database,flintstone $database
return Database