Interface: ISettingsManager

Interface for working with settings.

Extends

Known implementations

Authors

Oleg Schildt

Package

Source code

 

Methods
public

Returns the current settings context.

public

Returns the value of a settings parameter.

public

Returns the validator for the settings.

public

Initializes the settings manager with parameters.

public

Loads the settings from the persistence source.

public

Saves the settings from to the persistence target.

public

Sets the settings context.

public

Sets a settings parameter.

public

Sets settings parameters from an array.

public

Sets the validator for the settings.

public

Validates the current settings values.


Method: ISettingsManager::getContext()

public function getContext(): string;

Returns the current settings context.

Details

Settings might be edited not in one dialog, There can be several masks for different type of settings, or the settings can be configured in a wizard. In this case, only a subset of settings has to be saved and validated. To be able to write a flexible validator for the subsets, the $context is used. It can be - step1, step1, server_settings, db_connection_settings etc.

Returns

string

Returns the current settings context.

Authors

Oleg Schildt

Source code

See also


Method: ISettingsManager::getParameter()

public function getParameter(string $name, mixed|null $default = null): mixed;

Returns the value of a settings parameter.

Parameters

Name Pass type Value type Default value Description
$name by value string

The name of the settings parameter.

$default by value mixed|null null

The default value of the settings parameter if it is not set yet. The parameter is a conformable way to pre-set a parameter to a default value if its value is not set yet. However, if the status of the data is dirty and the unsaved last entered value is requested, then always the actual last entered value is returned and this parameter is ignored.

Returns

mixed

Returns the value of the settings parameter.

Authors

Oleg Schildt

Source code

See also


Method: ISettingsManager::getValidator()

public function getValidator(): ?\ISettingsValidator;

Returns the validator for the settings.

Returns

?\ISettingsValidator

Returns the validator for the settings or null if none is defined.

Authors

Oleg Schildt

Source code

See also


Method: ISettingsManager::init()

public function init(array $parameters): void;

Initializes the settings manager with parameters.

Parameters

Name Pass type Value type Default value Description
$parameters by value array

The parameters may vary for each settings manager.

Returns

void

Throws

\Exception

It might throw an exception in the case of any system errors.

Overrides

Authors

Oleg Schildt

Source code


Method: ISettingsManager::loadSettings()

public function loadSettings(): void;

Loads the settings from the persistence source.

Returns

void

Throws

\Exception

It might throw an exception in the case of any errors.

Authors

Oleg Schildt

Source code

See also


Method: ISettingsManager::saveSettings()

public function saveSettings(): void;

Saves the settings from to the persistence target.

Returns

void

Throws

\Exception

It might throw an exception in the case of any errors.

Authors

Oleg Schildt

Source code

See also


Method: ISettingsManager::setContext()

public function setContext(string $context = "default"): void;

Sets the settings context.

Details

Settings might be edited not in one dialog, There can be several masks for different type of settings, or the settings can be configured in a wizard. In this case, only a subset of settings has to be saved and validated. To be able to write a flexible validator for the subsets, the $context is used. It can be - step1, step1, server_settings, db_connection_settings etc.

Parameters

Name Pass type Value type Default value Description
$context by value string "default"

The settings context.

Returns

void

Authors

Oleg Schildt

Source code

See also


Method: ISettingsManager::setParameter()

public function setParameter(string $name, mixed $value): void;

Sets a settings parameter.

Parameters

Name Pass type Value type Default value Description
$name by value string

The name of the settings parameter.

$value by value mixed

The value of the settings parameter.

Returns

void

Authors

Oleg Schildt

Source code

See also


Method: ISettingsManager::setParameters()

public function setParameters(array $parameters, bool $force_creation = false): void;

Sets settings parameters from an array.

Parameters

Name Pass type Value type Default value Description
$parameters by value array

Array of parameters in the form key => value.

$force_creation by value bool false

Flag which defines whether the parameter should be created if not exists. If false, only existing parameters are updated.

Returns

void

Authors

Oleg Schildt

Source code

See also


Method: ISettingsManager::setValidator()

public function setValidator(\SmartFactory\Interfaces\ISettingsValidator $validator): void;

Sets the validator for the settings.

Parameters

Name Pass type Value type Default value Description
$validator by value \SmartFactory\Interfaces\ISettingsValidator

The settings validator.

Returns

void

Authors

Oleg Schildt

Source code

See also


Method: ISettingsManager::validateSettings()

public function validateSettings(): void;

Validates the current settings values.

Details

It should be called after settings the new values of the parameters and before their saving.

Returns

void

Throws

\SmartFactory\SmartException|\SmartFactory\SmartExceptionCollection

It might throw an exception if the content type oк JSON data is invalid.

Authors

Oleg Schildt

Source code

See also

Uses