/** * Install a class to the factory. * * @param string $Alias An alias for the class that will be used to retreive instances of it. * @param string $ClassName The actual name of the class. * @param string $Path The path to the class' file. You can prefix the path with ~ to start at the application root. * @param string $FactoryType The way objects will be instantiated for the class. One of (Gdn::FactoryInstance, Gdn::FactoryPrototype, Gdn::FactorySingleton). * @see Gdn_Factory::Install() */ public static function factoryInstall($Alias, $ClassName, $Path = '', $FactoryType = self::FactorySingleton, $Data = null) { // Don't overwrite an existing definition. if (self::$_FactoryOverwrite === false && self::factoryExists($Alias)) { return; } self::factory()->install($Alias, $ClassName, $Path, $FactoryType, $Data); // Cache some of the more commonly used factory objects as properties. switch ($Alias) { case self::AliasConfig: self::$_Config = self::factory($Alias); break; case self::AliasLocale: self::$_Locale = self::factory($Alias); break; case self::AliasRequest: self::$_Request = self::factory($Alias); break; case self::AliasPluginManager: self::$_PluginManager = self::factory($Alias); break; case self::AliasSession: self::$_Session = null; break; } }
/** * Install a class to the factory. * * @param string $Alias An alias for the class that will be used to retreive instances of it. * @param string $ClassName The actual name of the class. * @param string $Path The path to the class' file. You can prefix the path with ~ to start at the application root. * @param string $FactoryType The way objects will be instantiated for the class. One of (Gdn::FactoryInstance, Gdn::FactoryPrototype, Gdn::FactorySingleton). * @see Gdn_Factory::Install() */ public static function FactoryInstall($Alias, $ClassName, $Path, $FactoryType = self::FactoryInstance, $Data = NULL) { // Don't overwrite an existing definition. if (self::$_FactoryOverwrite === FALSE && self::FactoryExists($Alias)) { return; } self::$_Factory->Install($Alias, $ClassName, $Path, $FactoryType, $Data); // Cache some of the more commonly used factory objects as properties. switch ($Alias) { case self::AliasConfig: self::$_Config = self::Factory($Alias); break; case self::AliasRequest: self::$_Request = self::Factory($Alias); break; case self::AliasPluginManager: self::$_PluginManager = self::Factory($Alias); break; case self::AliasSession: self::$_Session = NULL; break; } }