class WordPressOption implements ArrayAccess

Properties

protected string $tableName Name of table.
protected array $fields Table description fields.
protected Plugin $plugin An instance of Plugin class or null.
protected array|null|object $row Option record.

Methods

__construct($plugin = null)

Create a new WordPressOption.

string
__toString()

Get the string representation (json) of the options.

array
toArray()

Return the flat array of the options.

array|mixed|string
get(string $path, string $default = "")

Return a branch/single option by path.

array|null
set(string $path, mixed $value = null)

Set (or remove) a branch/single option by path.

offsetSet($offset, $value)

No description

offsetExists($offset)

No description

offsetUnset($offset)

No description

offsetGet($offset)

No description

array
delete(string $path = '')

Delete a branch/single option by path.

false|int
update(array $options = [])

Update a branch of options.

false|int
delta()

Execute a delta from the current version of the options and the previous version stored in the database.

false|int
reset()

Load the default value from config/options.php and replace the current.

Details

at line 57
__construct($plugin = null)

Create a new WordPressOption.

Parameters

$plugin

at line 92
string __toString()

Get the string representation (json) of the options.

Return Value

string

at line 102
array toArray()

Return the flat array of the options.

Return Value

array

at line 119
array|mixed|string get(string $path, string $default = "")

Return a branch/single option by path.

Parameters

string $path The path option.
string $default Optional. A default value if the option doesn't exists.

Return Value

array|mixed|string

at line 149
array|null set(string $path, mixed $value = null)

Set (or remove) a branch/single option by path.

Parameters

string $path The path of the option.
mixed $value Optional. value to set, if null the option will be removed.

Return Value

array|null

at line 178
offsetSet($offset, $value)

Parameters

$offset
$value

at line 183
offsetExists($offset)

Parameters

$offset

at line 188
offsetUnset($offset)

Parameters

$offset

at line 193
offsetGet($offset)

Parameters

$offset

at line 205
array delete(string $path = '')

Delete a branch/single option by path.

Parameters

string $path The path of the option to delete.

Return Value

array

at line 244
false|int update(array $options = [])

Update a branch of options.

Parameters

array $options

Return Value

false|int

at line 270
false|int delta()

Execute a delta from the current version of the options and the previous version stored in the database.

Return Value

false|int

at line 298
false|int reset()

Load the default value from config/options.php and replace the current.

Return Value

false|int