PHP Class common\ModulesSettings

Author: Wouter Sioen ([email protected])
ファイルを表示 Open project: forkcms/forkcms Class Usage Examples

Public Methods

Method Description
__construct ( SpoonDatabase $database, Psr\Cache\CacheItemPoolInterface $cache )
delete ( string $module, string $key ) Deletes a module setting
get ( string $module, string $key, mixed $defaultValue = null ) : mixed Get a module setting
getForModule ( string $module ) : array Get all module settings for a module
set ( string $module, string $key, mixed $value ) Store a module setting

Private Methods

Method Description
getAllSettingsFromDatabase ( ) : array Reads all the settings from the database and groups them by module
getSettings ( ) : array Fetches all the settings

Method Details

__construct() public method

public __construct ( SpoonDatabase $database, Psr\Cache\CacheItemPoolInterface $cache )
$database SpoonDatabase
$cache Psr\Cache\CacheItemPoolInterface

delete() public method

Deletes a module setting
public delete ( string $module, string $key )
$module string
$key string

get() public method

Get a module setting
public get ( string $module, string $key, mixed $defaultValue = null ) : mixed
$module string The module wherefore a setting has to be retrieved.
$key string The name of the setting to be retrieved.
$defaultValue mixed A fallback value
return mixed

getForModule() public method

Get all module settings for a module
public getForModule ( string $module ) : array
$module string The module wherefore a setting has to be retrieved.
return array

set() public method

Store a module setting
public set ( string $module, string $key, mixed $value )
$module string The module wherefore a setting has to be stored.
$key string The name of the setting.
$value mixed The value to save