]> git.mxchange.org Git - friendica.git/blobdiff - src/BaseObject.php
Merge pull request #8027 from nupplaphil/task/session_remove_cookie
[friendica.git] / src / BaseObject.php
index 7aa012cef34f17cc7ead25d93326b6e637a1edcc..20481884517e565123d8b17f7038a6033250525a 100644 (file)
@@ -42,7 +42,7 @@ class BaseObject
         */
        public static function getApp()
        {
-               return self::$dice->create(App::class);
+               return self::getClass(App::class);
        }
 
        /**
@@ -56,7 +56,11 @@ class BaseObject
         */
        public static function getClass(string $name)
        {
-               if (class_exists($name) || interface_exists($name   )) {
+               if (empty(self::$dice)) {
+                       throw new InternalServerErrorException('DICE isn\'t initialized.');
+               }
+
+               if (class_exists($name) || interface_exists($name)) {
                        return self::$dice->create($name);
                } else {
                        throw new InternalServerErrorException('Class \'' . $name . '\' isn\'t valid.');