friendica/src/BaseObject.php

49 lines
645 B
PHP
Raw Normal View History

<?php
/**
* @file src/BaseObject.php
*/
namespace Friendica;
2018-12-30 15:42:56 -05:00
require_once 'boot.php';
use Friendica\Core\Logger;
/**
* 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
*
* @return App
*/
public static function getApp()
{
2018-06-25 20:44:35 -04:00
if (empty(self::$app)) {
2018-12-30 15:42:56 -05:00
$logger = Logger::create('app');
self::$app = new App(dirname(__DIR__), $logger);
}
return self::$app;
}
/**
* Set the app
*
2018-11-01 08:44:47 -04:00
* @param App $app App
*
* @return void
*/
2018-06-25 20:44:35 -04:00
public static function setApp(App $app)
{
self::$app = $app;
}
}