class utility
This commit is contained in:
		
							
								
								
									
										29
									
								
								application/core/ClassUtil.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								application/core/ClassUtil.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | |||||||
|  | <?php | ||||||
|  |  | ||||||
|  | namespace ManiaControl; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Utility Class offering Methods related to Classes | ||||||
|  |  * | ||||||
|  |  * @author    ManiaControl Team <mail@maniacontrol.com> | ||||||
|  |  * @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; | ||||||
|  | 	} | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user