/** * Get a new object, with loading its definition and configuration * * @param string $className The classname to create * @param array $cfg The config * @return object The new object */ public static function get($className, array $cfg = array()) { if (self::$cfg && ($tmp = self::$cfg->getInArray('classAlias', $className))) { $className = $tmp; } self::load($className); $ref = new nReflection(); if ($ref->rebuild($className)) { $prm = self::loadCfg($className); self::mergeCfg($prm, $cfg); $inst = $ref->newInstanceCfg(new config($prm)); return $inst; } else { throw new nException('Factory - load: Unable to bluid ' . $className . '.'); } }