TrackManiaControl/core/Utils/ClassUtil.php

31 lines
673 B
PHP
Raw Normal View History

2014-05-13 13:58:14 +02:00
<?php
namespace ManiaControl\Utils;
2014-05-13 13:58:14 +02:00
/**
* Utility Class offering Methods related to Classes
*
* @author ManiaControl Team <mail@maniacontrol.com>
2015-01-19 11:06:20 +01:00
* @copyright 2014-2015 ManiaControl Team
2014-05-13 13:58:14 +02:00
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
abstract class ClassUtil {
2014-06-26 11:07:53 +02:00
2014-05-13 13:58:14 +02:00
/**
* 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;
}
2014-05-24 22:34:57 +02:00
trigger_error("Invalid class param: '" . print_r($object, true) . "'!");
2014-05-13 13:58:14 +02:00
return (string)$object;
}
}