X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FBaseObject.php;h=9a2d064750b7d74ca13bc17fd2473323cf3298f8;hb=ce3b1210640ce653ef91cbf033788474c1f88b0c;hp=5adfe096d7dac1df67b1c1b481e1cb90e8071533;hpb=5640c42469b8ec1c5731b599b0dc9d9a0e762ce6;p=friendica.git diff --git a/src/BaseObject.php b/src/BaseObject.php index 5adfe096d7..9a2d064750 100644 --- a/src/BaseObject.php +++ b/src/BaseObject.php @@ -4,7 +4,9 @@ */ namespace Friendica; -require_once 'boot.php'; +require_once __DIR__ . '/../boot.php'; + +use Friendica\Network\HTTPException\InternalServerErrorException; /** * Basic object @@ -13,6 +15,9 @@ require_once 'boot.php'; */ class BaseObject { + /** + * @var App + */ private static $app = null; /** @@ -21,26 +26,25 @@ class BaseObject * Same as get_app from boot.php * * @return App + * @throws \Exception */ public static function getApp() { - if (self::$app) { - return self::$app; + if (empty(self::$app)) { + throw new InternalServerErrorException('App isn\'t initialized.'); } - self::$app = get_app(); - return self::$app; } /** * Set the app * - * @param object $app App + * @param App $app App * * @return void */ - public static function setApp($app) + public static function setApp(App $app) { self::$app = $app; }