2017-11-16 18:05:41 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2017-11-19 21:50:49 +00:00
|
|
|
* @file src/BaseObject.php
|
2017-11-16 18:05:41 +00:00
|
|
|
*/
|
2017-11-19 21:50:49 +00:00
|
|
|
namespace Friendica;
|
2017-11-16 18:05:41 +00:00
|
|
|
|
2018-12-30 20:42:56 +00:00
|
|
|
require_once 'boot.php';
|
|
|
|
|
|
|
|
use Friendica\Core\Logger;
|
|
|
|
|
2017-11-16 18:05:41 +00:00
|
|
|
/**
|
|
|
|
* Basic object
|
|
|
|
*
|
|
|
|
* Contains what is useful to any object
|
|
|
|
*/
|
|
|
|
class BaseObject
|
|
|
|
{
|
|
|
|
private static $app = null;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the app
|
|
|
|
*
|
|
|
|
* Same as get_app from boot.php
|
2017-11-19 19:15:25 +00:00
|
|
|
*
|
2017-12-17 16:34:43 +00:00
|
|
|
* @return App
|
2017-11-16 18:05:41 +00:00
|
|
|
*/
|
2017-11-19 21:50:49 +00:00
|
|
|
public static function getApp()
|
2017-11-16 18:05:41 +00:00
|
|
|
{
|
2018-06-26 00:44:35 +00:00
|
|
|
if (empty(self::$app)) {
|
2018-12-30 20:42:56 +00:00
|
|
|
$logger = Logger::create('app');
|
|
|
|
self::$app = new App(dirname(__DIR__), $logger);
|
2017-11-16 18:05:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return self::$app;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the app
|
|
|
|
*
|
2018-11-01 12:44:47 +00:00
|
|
|
* @param App $app App
|
2017-11-19 19:15:25 +00:00
|
|
|
*
|
|
|
|
* @return void
|
2017-11-16 18:05:41 +00:00
|
|
|
*/
|
2018-06-26 00:44:35 +00:00
|
|
|
public static function setApp(App $app)
|
2017-11-16 18:05:41 +00:00
|
|
|
{
|
|
|
|
self::$app = $app;
|
|
|
|
}
|
|
|
|
}
|