Database
extends AbstractStorage
in package
Debug database storage class
Tags
Table of Contents
Constants
Properties
- $db : AbstractAdapter|null
- DB adapter
- $format : string
- Storage format (json, php or text)
- $table : string
- Table
Methods
- __construct() : mixed
- Constructor
- clear() : void
- Clear all debug data
- decodeValue() : mixed
- Decode the value based on the format
- delete() : void
- Delete debug data by ID
- encodeValue() : string
- Encode the value based on the format
- getById() : mixed
- Get debug data by ID
- getByType() : mixed
- Get debug data by type
- getDb() : AbstractAdapter|null
- Get the current debug db adapter.
- getFormat() : string|null
- Get the storage format
- getTable() : string
- Get the current debug db table.
- has() : bool
- Determine if debug data exists by ID
- isJson() : bool
- Determine if the format is JSON
- isPhp() : bool
- Determine if the format is PHP
- isText() : bool
- Determine if the format is PHP
- save() : void
- Save debug data
- setDb() : Database
- Set the current debug db adapter.
- setFormat() : AbstractStorage
- Set the storage format
- setTable() : Database
- Set the debug db table
- createTable() : void
- Create table in database
Constants
JSON
public
mixed
JSON
= 'JSON'
PHP
public
mixed
PHP
= 'PHP'
TEXT
Format constants
public
mixed
TEXT
= 'TEXT'
Properties
$db
DB adapter
protected
AbstractAdapter|null
$db
= null
$format
Storage format (json, php or text)
protected
string
$format
= 'TEXT'
$table
Table
protected
string
$table
= 'pop_debug'
Methods
__construct()
Constructor
public
__construct(AbstractAdapter $db[, string $format = 'text' ][, string $table = 'pop_debug' ]) : mixed
Instantiate the DB writer object
The DB table requires the following fields at a minimum:
id INT
value TEXT, VARCHAR, etc.
Parameters
- $db : AbstractAdapter
- $format : string = 'text'
- $table : string = 'pop_debug'
clear()
Clear all debug data
public
clear() : void
decodeValue()
Decode the value based on the format
public
decodeValue(mixed $value) : mixed
Parameters
- $value : mixed
delete()
Delete debug data by ID
public
delete(string $id) : void
Parameters
- $id : string
encodeValue()
Encode the value based on the format
public
encodeValue(mixed $value) : string
Parameters
- $value : mixed
Tags
Return values
stringgetById()
Get debug data by ID
public
getById(string $id) : mixed
Parameters
- $id : string
getByType()
Get debug data by type
public
getByType(string $type) : mixed
Parameters
- $type : string
getDb()
Get the current debug db adapter.
public
getDb() : AbstractAdapter|null
Return values
AbstractAdapter|nullgetFormat()
Get the storage format
public
getFormat() : string|null
Return values
string|nullgetTable()
Get the current debug db table.
public
getTable() : string
Return values
stringhas()
Determine if debug data exists by ID
public
has(string $id) : bool
Parameters
- $id : string
Return values
boolisJson()
Determine if the format is JSON
public
isJson() : bool
Return values
boolisPhp()
Determine if the format is PHP
public
isPhp() : bool
Return values
boolisText()
Determine if the format is PHP
public
isText() : bool
Return values
boolsave()
Save debug data
public
save(string $id, mixed $value) : void
Parameters
- $id : string
- $value : mixed
setDb()
Set the current debug db adapter.
public
setDb(AbstractAdapter $db) : Database
Parameters
- $db : AbstractAdapter
Return values
DatabasesetFormat()
Set the storage format
public
setFormat(string $format) : AbstractStorage
Parameters
- $format : string
Return values
AbstractStoragesetTable()
Set the debug db table
public
setTable(string $table) : Database
Parameters
- $table : string
Return values
DatabasecreateTable()
Create table in database
protected
createTable() : void