]> git.mxchange.org Git - friendica.git/blob - src/Core/PConfig.php
Move PConfig::get() to DI::pConfig()->get()
[friendica.git] / src / Core / PConfig.php
1 <?php
2 /**
3  * User Configuration Class
4  *
5  * @file include/Core/PConfig.php
6  *
7  * @brief Contains the class with methods for user configuration
8  */
9 namespace Friendica\Core;
10
11 use Friendica\DI;
12
13 /**
14  * @brief Management of user configuration storage
15  * Note:
16  * Please do not store booleans - convert to 0/1 integer values
17  * The DI::pConfig()->get() functions return boolean false for keys that are unset,
18  * and this could lead to subtle bugs.
19  */
20 class PConfig
21 {
22         /**
23          * @brief Sets a configuration value for a user
24          *
25          * @param int    $uid    The user_id
26          * @param string $cat    The category of the configuration value
27          * @param string $key    The configuration key to set
28          * @param mixed  $value  The value to store
29          *
30          * @return bool Operation success
31          */
32         public static function set(int $uid, string $cat, string $key, $value)
33         {
34                 return DI::pConfig()->set($uid, $cat, $key, $value);
35         }
36
37         /**
38          * @brief Deletes the given key from the users's configuration.
39          *
40          * @param int    $uid The user_id
41          * @param string $cat The category of the configuration value
42          * @param string $key The configuration key to delete
43          *
44          * @return bool
45          */
46         public static function delete(int $uid, string $cat, string $key)
47         {
48                 return DI::pConfig()->delete($uid, $cat, $key);
49         }
50 }