mirror of
https://github.com/friendica/friendica
synced 2024-12-23 16:40:17 +00:00
ad854d5d40
- Fix errors running local tests in IDE
48 lines
703 B
PHP
48 lines
703 B
PHP
<?php
|
|
/**
|
|
* @file src/BaseObject.php
|
|
*/
|
|
namespace Friendica;
|
|
|
|
require_once __DIR__ . '/../boot.php';
|
|
|
|
use Friendica\Network\HTTPException\InternalServerErrorException;
|
|
|
|
/**
|
|
* 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
|
|
* @throws \Exception
|
|
*/
|
|
public static function getApp()
|
|
{
|
|
if (empty(self::$app)) {
|
|
throw new InternalServerErrorException('App isn\'t initialized.');
|
|
}
|
|
|
|
return self::$app;
|
|
}
|
|
|
|
/**
|
|
* Set the app
|
|
*
|
|
* @param App $app App
|
|
*
|
|
* @return void
|
|
*/
|
|
public static function setApp(App $app)
|
|
{
|
|
self::$app = $app;
|
|
}
|
|
}
|