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

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

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