• Full name: \App\Infrastructure\Services\Options
  • This class is marked as final and can't be subclassed
  • This class is a Final class

Properties

dfdb

protected \Qubus\Expressive\Database $dfdb

cache

protected \Psr\SimpleCache\CacheInterface $cache

Methods

__construct

public __construct(\Qubus\Expressive\Database $dfdb, \Psr\SimpleCache\CacheInterface $cache): mixed

Parameters:

Parameter Type Description
$dfdb \Qubus\Expressive\Database
$cache \Psr\SimpleCache\CacheInterface

factory

public static factory(): \App\Infrastructure\Services\Options

create

Add an option to the table.

public create(string $name, mixed $value = ''): bool

Parameters:

Parameter Type Description
$name string
$value mixed

Throws:


read

Read an option from options_meta.

public read(mixed $optionKey, mixed $default = ''): mixed

Return value or $default if not found.

Parameters:

Parameter Type Description
$optionKey mixed
$default mixed

Throws:


update

Update (add if it doesn't exist) an option to option's table.

public update(string $optionKey, mixed $newvalue): bool

Parameters:

Parameter Type Description
$optionKey string
$newvalue mixed

Throws:


delete

Delete an option from the table.

public delete(string $name): bool

Parameters:

Parameter Type Description
$name string

Throws:


massUpdate

Update an array of options to the option's table.

public massUpdate(array $options): bool

Best to validate the data array first before running this method.

Parameters:

Parameter Type Description
$options array

Throws:


exists

Checks if a key exists in the option table.

public exists(string $optionKey): bool

Parameters:

Parameter Type Description
$optionKey string Key to check against.