]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/PConfig.php
Remove deprecated App::getHostName() - process methods to DI::baseUrl()->getHostName()
[friendica.git] / src / Core / PConfig.php
index 99f0c8320e7af1cffa2006a463a6daf524b28232..06b0140097697538226f58341e1c17d859d6e683 100644 (file)
@@ -8,6 +8,8 @@
  */
 namespace Friendica\Core;
 
+use Friendica\DI;
+
 /**
  * @brief Management of user configuration storage
  * Note:
@@ -17,21 +19,6 @@ namespace Friendica\Core;
  */
 class PConfig
 {
-       /**
-        * @var Config\PConfiguration
-        */
-       private static $config;
-
-       /**
-        * Initialize the config with only the cache
-        *
-        * @param Config\PConfiguration $config The configuration cache
-        */
-       public static function init(Config\PConfiguration $config)
-       {
-               self::$config = $config;
-       }
-
        /**
         * @brief Loads all configuration values of a user's config family into a cached storage.
         *
@@ -40,9 +27,9 @@ class PConfig
         *
         * @return void
         */
-       public static function load(int $uid, $cat)
+       public static function load(int $uid, string $cat)
        {
-               self::$config->load($uid, $cat);
+               DI::pConfig()->load($uid, $cat);
        }
 
        /**
@@ -57,9 +44,9 @@ class PConfig
         *
         * @return mixed Stored value or null if it does not exist
         */
-       public static function get(int $uid, $cat, $key, $default_value = null, $refresh = false)
+       public static function get(int $uid, string $cat, string $key, $default_value = null, bool $refresh = false)
        {
-               return self::$config->get($uid, $cat, $key, $default_value, $refresh);
+               return DI::pConfig()->get($uid, $cat, $key, $default_value, $refresh);
        }
 
        /**
@@ -72,9 +59,9 @@ class PConfig
         *
         * @return bool Operation success
         */
-       public static function set(int $uid, $cat, $key, $value)
+       public static function set(int $uid, string $cat, string $key, $value)
        {
-               return self::$config->set($uid, $cat, $key, $value);
+               return DI::pConfig()->set($uid, $cat, $key, $value);
        }
 
        /**
@@ -86,8 +73,8 @@ class PConfig
         *
         * @return bool
         */
-       public static function delete(int $uid, $cat, $key)
+       public static function delete(int $uid, string $cat, string $key)
        {
-               return self::$config->delete($uid, $cat, $key);
+               return DI::pConfig()->delete($uid, $cat, $key);
        }
 }