From 4a1de47513627611ed64921cb1c59b57c2e41d42 Mon Sep 17 00:00:00 2001
From: Adam Magness <adam.magness@gmail.com>
Date: Thu, 16 Nov 2017 13:05:41 -0500
Subject: [PATCH] BaseObject moved to src/Core

BaseObject moved to Friendica\Core namespace. References and function calls updated.
---
 index.php                 | 13 +++--------
 object/BaseObject.php     | 35 -----------------------------
 object/Conversation.php   | 15 ++++++++-----
 object/Item.php           | 12 ++++++----
 object/TemplateEngine.php | 12 ++++++----
 src/Core/BaseObject.php   | 47 +++++++++++++++++++++++++++++++++++++++
 6 files changed, 76 insertions(+), 58 deletions(-)
 delete mode 100644 object/BaseObject.php
 create mode 100644 src/Core/BaseObject.php

diff --git a/index.php b/index.php
index 5915498904..c31b1adc0f 100644
--- a/index.php
+++ b/index.php
@@ -1,26 +1,21 @@
 <?php
-
-
 /**
- *
+ * @file index.php
  * Friendica
- *
  */
 
 /**
- *
- * bootstrap the application
- *
+ * Bootstrap the application
  */
 
 use Friendica\App;
+use Friendica\Core\BaseObject;
 use Friendica\Core\System;
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
 use Friendica\Database\DBM;
 
 require_once 'boot.php';
-require_once 'object/BaseObject.php';
 
 if (empty($a)) {
 	$a = new App(__DIR__);
@@ -32,11 +27,9 @@ BaseObject::set_app($a);
 $a->backend = false;
 
 /**
- *
  * Load the configuration file which contains our DB credentials.
  * Ignore errors. If the file doesn't exist or is empty, we are running in
  * installation mode.
- *
  */
 
 $install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? false : true);
diff --git a/object/BaseObject.php b/object/BaseObject.php
deleted file mode 100644
index 15c7d8dc65..0000000000
--- a/object/BaseObject.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-if(class_exists('BaseObject'))
-	return;
-
-require_once('boot.php');
-
-/**
- * Basic object
- *
- * Contains what is usefull to any object
- */
-class BaseObject {
-	private static $app = null;
-
-	/**
-	 * Get the app
-	 *
-	 * Same as get_app from boot.php
-	 */
-	public function get_app() {
-		if(self::$app)
-			return self::$app;
-
-		self::$app = get_app();
-
-		return self::$app;
-	}
-
-	/**
-	 * Set the app
-	 */
-	public static function set_app($app) {
-		self::$app = $app;
-	}
-}
diff --git a/object/Conversation.php b/object/Conversation.php
index f03b3b1c1b..3b3560f140 100644
--- a/object/Conversation.php
+++ b/object/Conversation.php
@@ -1,11 +1,16 @@
 <?php
-if(class_exists('Conversation'))
+/**
+ * @file object/Conversation.php
+ */
+if (class_exists('Conversation')) {
 	return;
+}
 
-require_once('boot.php');
-require_once('object/BaseObject.php');
-require_once('object/Item.php');
-require_once('include/text.php');
+use Friendica\Core\BaseObject;
+
+require_once 'boot.php';
+require_once 'object/Item.php';
+require_once 'include/text.php';
 
 /**
  * A list of threads
diff --git a/object/Item.php b/object/Item.php
index 80bbf255dd..0dab971d1b 100644
--- a/object/Item.php
+++ b/object/Item.php
@@ -1,15 +1,19 @@
 <?php
-if(class_exists('Item'))
+/**
+ * @file object/Item.php
+ */
+if (class_exists('Item')) {
 	return;
+}
 
+use Friendica\Core\BaseObject;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Database\DBM;
 use Friendica\Protocol\Diaspora;
 
-require_once('object/BaseObject.php');
-require_once('include/text.php');
-require_once('boot.php');
+require_once 'include/text.php';
+require_once 'boot.php';
 
 /**
  * An item
diff --git a/object/TemplateEngine.php b/object/TemplateEngine.php
index cbd74aaec9..61ccb01dcf 100644
--- a/object/TemplateEngine.php
+++ b/object/TemplateEngine.php
@@ -1,11 +1,15 @@
 <?php
-require_once 'boot.php';
+/**
+ * @file object/TemplateEngine.php
+ */
 
+require_once 'boot.php';
 
 /**
  * Interface for template engines
  */
-interface ITemplateEngine {
-	public function replace_macros($s,$v);
-	public function get_template_file($file, $root='');
+interface ITemplateEngine
+{
+	public function replace_macros($s, $v);
+	public function get_template_file($file, $root = '');
 }
diff --git a/src/Core/BaseObject.php b/src/Core/BaseObject.php
new file mode 100644
index 0000000000..6037f59838
--- /dev/null
+++ b/src/Core/BaseObject.php
@@ -0,0 +1,47 @@
+<?php
+/**
+ * @file src/Core/BaseObject.php
+ */
+namespace Friendica\Core;
+
+if (class_exists('BaseObject')) {
+	return;
+}
+
+require_once 'boot.php';
+
+/**
+ * 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
+	 */
+	public function get_app()
+	{
+		if (self::$app) {
+			return self::$app;
+		}
+
+		self::$app = boot::get_app();
+
+		return self::$app;
+	}
+
+	/**
+	 * Set the app
+	 *
+	 * @param object $app App
+	 */
+	public static function set_app($app)
+	{
+		self::$app = $app;
+	}
+}