]> git.mxchange.org Git - friendica.git/blob - src/Core/Config/IConfigAdapter.php
70e141484eb3bd05cd6b3586dd2bdb0751c47fcd
[friendica.git] / src / Core / Config / IConfigAdapter.php
1 <?php
2
3 namespace Friendica\Core\Config;
4
5 /**
6  *
7  * @author Hypolite Petovan <hypolite@mrpetovan.com>
8  */
9 interface IConfigAdapter
10 {
11         /**
12          * Loads all configuration values into a cached storage.
13          *
14          * @param string  $cat The category of the configuration values to load
15          *
16          * @return void
17          */
18         public function load($cat = "config");
19
20         /**
21          * Get a particular user's config variable given the category name
22          * ($family) and a key.
23          *
24          * @param string  $cat           The category of the configuration value
25          * @param string  $k             The configuration key to query
26          * @param mixed   $default_value optional, The value to return if key is not set (default: null)
27          * @param boolean $refresh       optional, If true the config is loaded from the db and not from the cache (default: false)
28          *
29          * @return mixed Stored value or null if it does not exist
30          */
31         public function get($cat, $k, $default_value = null, $refresh = false);
32
33         /**
34          * Stores a config value ($value) in the category ($family) under the key ($key)
35          * for the user_id $uid.
36          *
37          * Note: Please do not store booleans - convert to 0/1 integer values!
38          *
39          * @param string $cat   The category of the configuration value
40          * @param string $k     The configuration key to set
41          * @param mixed  $value The value to store
42          *
43          * @return bool Operation success
44          */
45         public function set($cat, $k, $value);
46
47         /**
48          * Removes the configured value from the stored cache
49          * and removes it from the database.
50          *
51          * @param string $cat The category of the configuration value
52          * @param string $k   The configuration key to delete
53          *
54          * @return mixed
55          */
56         public function delete($cat, $k);
57
58         /**
59          * Checks, if the current adapter is connected to the backend
60          *
61          * @return bool
62          */
63         public function isConnected();
64 }