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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (hide annotations)
Tue Mar 11 00:42:39 2003 UTC (21 years, 4 months ago) by joko
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +5 -1 lines
+ fixed metadata for phpDocumentor

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

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