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

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

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