/[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.2 by joko, Mon Feb 3 04:59:29 2003 UTC revision 1.5 by joko, Mon Mar 3 21:11:01 2003 UTC
# Line 3  Line 3 
3  //  $Id$  //  $Id$
4  // ---------------------------------------------------------------------------  // ---------------------------------------------------------------------------
5  //  $Log$  //  $Log$
6    //  Revision 1.5  2003/03/03 21:11:01  joko
7    //  mungled the namespaces
8    //
9    //  Revision 1.4  2003/02/09 17:03:35  joko
10    //  + additional get-/setter methods
11    //
12    //  Revision 1.3  2003/02/03 14:41:21  joko
13    //  + get- and set-methods to access configuration variables
14    //  + recursive merging mechanism
15    //
16  //  Revision 1.2  2003/02/03 04:59:29  joko  //  Revision 1.2  2003/02/03 04:59:29  joko
17  //  + fixed: constructor can now get passed variable of *any type*  //  + fixed: constructor can now get passed variable of *any type*
18  //  //
# Line 28  Line 38 
38    
39  */  */
40    
41    
42  class Application_Config {  class Application_Config {
43        
44    var $_store;    var $_store;
# Line 37  class Application_Config { Line 48  class Application_Config {
48      //print "initCfg:<br/>" . Dumper($initCfg) . "<hr/>";      //print "initCfg:<br/>" . Dumper($initCfg) . "<hr/>";
49      $this->_store = $initCfg;      $this->_store = $initCfg;
50    }    }
51      
52      function merge() {
53        //$this->_store[run] = array_merge($this->_store['default'], $this->_store['init']);
54    //print Dumper($this);
55        foreach ($this->_store[_init][configkeys] as $configKey) {
56          //$this->_store[runtime] = array_merge($this->_store[runtime], $this->_store[$configKey]);
57          //$this->_store[runtime] = array_merge_recursive($this->_store[runtime], $this->_store[$configKey]);
58          $this->_store[runtime] = php::array_join_merge($this->_store[runtime], $this->_store[$configKey]);
59        }
60        //print Dumper($this);
61      }
62      
63      function get($var = null) {
64        //$this->merge();
65        if ($var) {
66          return $this->get_absolute("runtime.$var");
67        } else {
68          return $this->get_absolute("runtime");
69        }
70      }
71      
72      function set_absolute($var, $val) {
73        //$this->_store[runtime][$var] = $val;
74        //$deep = new Data_Deep($this->_store[runtime]);
75        $deep = new Data_Deep($this->_store);
76        $deep->set($var, $val);
77      }
78      
79      function get_absolute($var) {
80        //$this->_store[runtime][$var] = $val;
81        //$deep = new Data_Deep($this->_store[runtime]);
82        $deep = new Data_Deep($this->_store);
83        return $deep->get($var);
84      }
85      
86  }  }
87    
88  ?>  ?>

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.5

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