]> git.mxchange.org Git - friendica.git/blob - src/Core/Config/IConfig.php
Remove duplicate profile_uid key in App->profile array
[friendica.git] / src / Core / Config / IConfig.php
1 <?php
2
3 namespace Friendica\Core\Config;
4
5 /**
6  * Interface for accessing system wide configurations
7  */
8 interface IConfig
9 {
10
11         /**
12          * Loads all configuration values of family into a cached storage.
13          *
14          * All configuration values of the system are stored in the cache ( @param string $cat The category of the configuration value
15          *
16          * @return void
17          */
18         function load(string $cat = 'config');
19
20         /**
21          * Get a particular user's config variable given the category name
22          * ($cat) and a $key.
23          *
24          * Get a particular config value from the given category ($cat)
25          * and the $key from a cached storage either from the $this->configAdapter
26          * (@see IConfigAdapter) or from the $this->configCache (@see ConfigCache).
27          *
28          * @param string  $cat        The category of the configuration value
29          * @param string  $key           The configuration key to query
30          * @param mixed   $default_value optional, The value to return if key is not set (default: null)
31          * @param boolean $refresh       optional, If true the config is loaded from the db and not from the cache (default: false)
32          *
33          * @return mixed Stored value or null if it does not exist
34          */
35         function get(string $cat, string $key, $default_value = null, bool $refresh = false);
36
37         /**
38          * Sets a configuration value for system config
39          *
40          * Stores a config value ($value) in the category ($cat) under the key ($key)
41          *
42          * Note: Please do not store booleans - convert to 0/1 integer values!
43          *
44          * @param string $cat The category of the configuration value
45          * @param string $key    The configuration key to set
46          * @param mixed  $value  The value to store
47          *
48          * @return bool Operation success
49          */
50         function set(string $cat, string $key, $value);
51
52         /**
53          * Deletes the given key from the system configuration.
54          *
55          * Removes the configured value from the stored cache in $this->configCache
56          * (@see ConfigCache) and removes it from the database (@see IConfigAdapter).
57          *
58          * @param string $cat The category of the configuration value
59          * @param string $key    The configuration key to delete
60          *
61          * @return bool
62          */
63         function delete(string $cat, string $key);
64
65         /**
66          * Returns the Config Cache
67          *
68          * @return Cache
69          */
70         function getCache();
71 }