/[cvs]/nfo/php/libs/org.netfrag.glib/Application/Config.php
ViewVC logotype

Diff of /nfo/php/libs/org.netfrag.glib/Application/Config.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by joko, Mon Feb 3 03:51:36 2003 UTC revision 1.7 by joko, Tue Mar 11 00:12:45 2003 UTC
# Line 1  Line 1 
1  <?  <?
2    /**
3     * This file contains the Application::Config class.
4     *
5     * @author Andreas Motl <andreas.motl@ilo.de>
6     * @name Application::Config
7     *
8     */
9    
10    
11  // ---------------------------------------------------------------------------  // ---------------------------------------------------------------------------
12  //  $Id$  //  $Id$
13  // ---------------------------------------------------------------------------  // ---------------------------------------------------------------------------
14  //  $Log$  //  $Log$
15    //  Revision 1.7  2003/03/11 00:12:45  joko
16    //  + fixed metadata for phpDocumentor
17    //
18    //  Revision 1.6  2003/03/10 23:45:29  joko
19    //  + fixed metadata for phpDocumentor
20    //
21    //  Revision 1.5  2003/03/03 21:11:01  joko
22    //  mungled the namespaces
23    //
24    //  Revision 1.4  2003/02/09 17:03:35  joko
25    //  + additional get-/setter methods
26    //
27    //  Revision 1.3  2003/02/03 14:41:21  joko
28    //  + get- and set-methods to access configuration variables
29    //  + recursive merging mechanism
30    //
31    //  Revision 1.2  2003/02/03 04:59:29  joko
32    //  + fixed: constructor can now get passed variable of *any type*
33    //
34  //  Revision 1.1  2003/02/03 03:51:36  joko  //  Revision 1.1  2003/02/03 03:51:36  joko
35  //  + initial commit  //  + initial commit
36  //  //
# Line 11  Line 39 
39    
40  /*  /*
41    
42    How to use this?    ------------------------------------------------------------
43        How to use this?
44      ------------------------------------------------------------
45    
46      require_once("../etc/defaults.php");      require_once("../etc/defaults.php");
47      require_once("../etc/includes.php");      require_once("../etc/includes.php");
# Line 19  Line 49 
49      $appConfig = mkObject('Application::Config');      $appConfig = mkObject('Application::Config');
50      print "appConfig:<br/>" . Dumper($appConfig) . "<hr/>";      print "appConfig:<br/>" . Dumper($appConfig) . "<hr/>";
51    
52      ------------------------------------------------------------
53    
54  */  */
55    
56    
57    /**
58     * --- Application_Config
59     *
60     * @author Andreas Motl <andreas.motl@ilo.de>
61     * @package org.netfrag.glib
62     * @subpackage Application
63     * @name Application::Config
64     *
65     */
66  class Application_Config {  class Application_Config {
67    function Application_Config($initCfg = array()) {    
68      print "Hello World!<hr/>";    var $_store;
69      print "initCfg:<br/>" . Dumper($initCfg) . "<hr/>";    
70      function Application_Config($initCfg = null) {
71        //print "Hello World!<hr/>";
72        //print "initCfg:<br/>" . Dumper($initCfg) . "<hr/>";
73        $this->_store = $initCfg;
74      }
75      
76      function merge() {
77        //$this->_store[run] = array_merge($this->_store['default'], $this->_store['init']);
78    //print Dumper($this);
79        foreach ($this->_store[_init][configkeys] as $configKey) {
80          //$this->_store[runtime] = array_merge($this->_store[runtime], $this->_store[$configKey]);
81          //$this->_store[runtime] = array_merge_recursive($this->_store[runtime], $this->_store[$configKey]);
82          $this->_store[runtime] = php::array_join_merge($this->_store[runtime], $this->_store[$configKey]);
83        }
84        //print Dumper($this);
85      }
86      
87      function get($var = null) {
88        //$this->merge();
89        if ($var) {
90          return $this->get_absolute("runtime.$var");
91        } else {
92          return $this->get_absolute("runtime");
93        }
94      }
95      
96      function set_absolute($var, $val) {
97        //$this->_store[runtime][$var] = $val;
98        //$deep = new Data_Deep($this->_store[runtime]);
99        $deep = new Data_Deep($this->_store);
100        $deep->set($var, $val);
101      }
102      
103      function get_absolute($var) {
104        //$this->_store[runtime][$var] = $val;
105        //$deep = new Data_Deep($this->_store[runtime]);
106        $deep = new Data_Deep($this->_store);
107        return $deep->get($var);
108    }    }
109      
110  }  }
111    
112  ?>  ?>

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.7

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed