sTEFANs Subversion Web Contol (SWC)
Config
[ class tree: Swc ] [ index: Swc ] [ all elements ]

Source for file std_config_factory.inc.php

Documentation is available at std_config_factory.inc.php

  1. <?php
  2. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3. SVN Web Control
  4. Copyright ©2006 by sTEFANs
  5. Created on 26.02.2006
  6. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 59 Temple Place - Suite 330,
  20. Boston, MA 02111-1307, USA.
  21. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  22. */
  23.  
  24. /**
  25.  * This file contains default implementation for project configuration.
  26.  * <b>Please have a close look to this file for details on <i>SwcConfigFactory</i></b>.
  27.  * 
  28.  * @package Swc
  29.  * @subpackage Config
  30.  * @author Stefan Schraml
  31.  * @copyright Copyright ©2006 by sTEFANs
  32.  * @license http://opensource.org/licenses/lgpl-license.php GNU General Public License
  33.  * @version v1.0.0
  34.  * @since v1.0.0
  35.  */
  36.  
  37. /** Interfaces for configuration. */
  38. require_once ('inc/config.inc.php');
  39. /** Sample configuration for TestProject1. */
  40. include_once ('config/std_config1.inc.php');
  41. /** Sample configuration for TestProject2. */
  42. include_once ('config/std_config2.inc.php');
  43.  
  44. /** 
  45.  * Returns a the default factory for <b>SwcConfig</b>.
  46.  * Usually it is used if no other config factory file
  47.  * is provided within URL-parameters for index.php.
  48.  * @see index.php
  49.  * @see config.inc.php
  50.  * @see SwcConfigFactory
  51.  * 
  52.  * @since v1.0.0
  53.  */
  54. function GetSwcConfigFactory(){
  55.     return DefaultConfigFactory::GetInstance();
  56. }
  57.  
  58. /** Implements the <b>SwcConfigFactory</b> that
  59.  * provides per default any <b>SwcConfig</b>s
  60.  * for several projects. If more than one
  61.  * Config is provided, SWC offers a list
  62.  * of all available (configured) projects.
  63.  * In this example a config for test project 1
  64.  * and for test project 2 is provided.
  65.  * @see SwcConfigFactory
  66.  * 
  67.  * @package Swc
  68.  * @subpackage Config
  69.  * @since v1.0.0
  70.  */
  71. class DefaultConfigFactory implements SwcConfigFactory {
  72.     
  73.     private static $instance NULL;
  74.     private $configs = NULL;
  75.     
  76.     /** 
  77.      * Returns the single instance of this class.
  78.      * 
  79.      * @since v1.0.0
  80.      */
  81.     public static function GetInstance(){
  82.         if (self::$instance == NULL){
  83.             self::$instance new DefaultConfigFactory();
  84.         }
  85.         return self::$instance;
  86.     }
  87.     
  88.     /** 
  89.      * Returns an array with instances of prjoect configurations.
  90.      * @return array Array with <b>SwcConfig</b> objects.
  91.      * 
  92.      * @since v1.0.0
  93.      */ 
  94.     public function GetSwcConfigs(){
  95.         return $this->configs;
  96.     }
  97.     
  98.     /** 
  99.      * Does nothing but prevent from cloning.
  100.      * 
  101.      * @since v1.0.0
  102.      */
  103.     public function __clone(){
  104.   }
  105.     
  106.     /** 
  107.      * Singleton c'tor that instantiates <i>SwcConfig</i>s.
  108.      * <b>Add the project configuration class for
  109.      * your projects here</b>.
  110.      * 
  111.      * @since v1.0.0
  112.      */
  113.     private function __construct(){
  114.         $this->configs = array();
  115.         $this->configs[new TestProject1Config();
  116.         $this->configs[new TestProject2Config();
  117.     }
  118. }
  119. ?>

Documentation generated on Fri, 03 Nov 2006 18:45:00 +0100 by phpDocumentor 1.3.0RC6
for sTEFANs POWERED BY eBC.bz