Introduction Change History
Documentation is available at std_config_factory.inc.php
<?php /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SVN Web Control Copyright ©2006 by sTEFANs Created on 26.02.2006 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ /** * This file contains default implementation for project configuration. * <b>Please have a close look to this file for details on <i>SwcConfigFactory</i></b>. * * @package Swc * @subpackage Config * @author Stefan Schraml * @copyright Copyright ©2006 by sTEFANs * @license http://opensource.org/licenses/lgpl-license.php GNU General Public License * @version v1.0.0 * @since v1.0.0 */ /** Interfaces for configuration. */ require_once ('inc/config.inc.php'); /** Sample configuration for TestProject1. */ include_once ('config/std_config1.inc.php'); /** Sample configuration for TestProject2. */ include_once ('config/std_config2.inc.php'); /** * Returns a the default factory for <b>SwcConfig</b>. * Usually it is used if no other config factory file * is provided within URL-parameters for index.php. * @see index.php * @see config.inc.php * @see SwcConfigFactory * * @since v1.0.0 */ function GetSwcConfigFactory(){ return DefaultConfigFactory::GetInstance(); } /** Implements the <b>SwcConfigFactory</b> that * provides per default any <b>SwcConfig</b>s * for several projects. If more than one * Config is provided, SWC offers a list * of all available (configured) projects. * In this example a config for test project 1 * and for test project 2 is provided. * @see SwcConfigFactory * * @package Swc * @subpackage Config * @since v1.0.0 */ class DefaultConfigFactory implements SwcConfigFactory { private static $instance = NULL; private $configs = NULL; /** * Returns the single instance of this class. * * @since v1.0.0 */ public static function GetInstance(){ if (self::$instance == NULL){ self::$instance = new DefaultConfigFactory(); } return self::$instance; } /** * Returns an array with instances of prjoect configurations. * @return array Array with <b>SwcConfig</b> objects. * * @since v1.0.0 */ public function GetSwcConfigs(){ return $this->configs; } /** * Does nothing but prevent from cloning. * * @since v1.0.0 */ public function __clone(){ } /** * Singleton c'tor that instantiates <i>SwcConfig</i>s. * <b>Add the project configuration class for * your projects here</b>. * * @since v1.0.0 */ private function __construct(){ $this->configs = array(); $this->configs[] = new TestProject1Config(); $this->configs[] = new TestProject2Config(); } } ?>