/** * Gets an object of a class with the stored name passed as parameter. * * The method loads a stored object, which has to be stored with storeObject() before. * The parameter is case sensitive. On failure a CoreException will be thrown (error code 1). * * Alternative: You can use the global wrapper function Core to get the stored objects. Just use * Core(DB) for the DB class or Core(My) for an object that as been stored under the name My. * You can either specify a string with the name or the constant as parameter. * * @param string|int Stored name of object as string or constant (internally that's an int) * @return Object Returns the object * @see Core() * @throws CoreException */ public static function getObject($objectId) { if (is_string($objectId)) { $objectId = constant($objectId); } if (isset(self::$namedObjects[$objectId]) && is_object(self::$namedObjects[$objectId])) { return self::$namedObjects[$objectId]; } else { $e = new CoreException("Object with name '{$objectId}' not found.", 1); $e->setArrayData(self::$namedObjects); throw $e; } }