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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (show annotations)
Mon Mar 10 23:45:29 2003 UTC (21 years, 5 months ago) by joko
Branch: MAIN
Changes since 1.5: +22 -1 lines
+ fixed metadata for phpDocumentor

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

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