From 411f23a6188df8b1a7520ba17be8007a34ab97f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Tue, 13 May 2014 13:58:14 +0200 Subject: [PATCH] class utility --- application/core/ClassUtil.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 application/core/ClassUtil.php diff --git a/application/core/ClassUtil.php b/application/core/ClassUtil.php new file mode 100644 index 00000000..3f0cb823 --- /dev/null +++ b/application/core/ClassUtil.php @@ -0,0 +1,29 @@ + + * @copyright 2014 ManiaControl Team + * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 + */ +abstract class ClassUtil { + /** + * Get the Class Name of the given Object + * + * @param mixed $object + * @return string + */ + public static function getClass($object) { + if (is_object($object)) { + return get_class($object); + } + if (is_string($object)) { + return $object; + } + trigger_error("Invalid class param: '{$object}'!"); + return (string)$object; + } +}