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 |
// Revision 1.3 2003/02/03 14:41:21 joko |
32 |
// + get- and set-methods to access configuration variables |
// + get- and set-methods to access configuration variables |
33 |
// + recursive merging mechanism |
// + recursive merging mechanism |
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 |
|
|
72 |
var $_store; |
var $_store; |
79 |
|
|
80 |
function merge() { |
function merge() { |
81 |
//$this->_store[run] = array_merge($this->_store['default'], $this->_store['init']); |
//$this->_store[run] = array_merge($this->_store['default'], $this->_store['init']); |
82 |
|
//print Dumper($this); |
83 |
foreach ($this->_store[_init][configkeys] as $configKey) { |
foreach ($this->_store[_init][configkeys] as $configKey) { |
84 |
//$this->_store[runtime] = array_merge($this->_store[runtime], $this->_store[$configKey]); |
//$this->_store[runtime] = array_merge($this->_store[runtime], $this->_store[$configKey]); |
85 |
//$this->_store[runtime] = array_merge_recursive($this->_store[runtime], $this->_store[$configKey]); |
//$this->_store[runtime] = array_merge_recursive($this->_store[runtime], $this->_store[$configKey]); |
86 |
$this->_store[runtime] = array_join_merge($this->_store[runtime], $this->_store[$configKey]); |
$this->_store[runtime] = php::array_join_merge($this->_store[runtime], $this->_store[$configKey]); |
87 |
} |
} |
88 |
//print Dumper($this); |
//print Dumper($this); |
89 |
} |
} |
90 |
|
|
91 |
function getPart($var = null) { |
function get($var = null) { |
92 |
//$this->merge(); |
//$this->merge(); |
93 |
if ($var) { |
if ($var) { |
94 |
return $this->getVar("runtime.$var"); |
return $this->get_absolute("runtime.$var"); |
95 |
} else { |
} else { |
96 |
return $this->getVar("runtime"); |
return $this->get_absolute("runtime"); |
97 |
} |
} |
98 |
} |
} |
99 |
|
|
100 |
function setVar($var, $val) { |
function set_absolute($var, $val) { |
101 |
//$this->_store[runtime][$var] = $val; |
//$this->_store[runtime][$var] = $val; |
102 |
//$deep = new Data_Deep($this->_store[runtime]); |
//$deep = new Data_Deep($this->_store[runtime]); |
103 |
$deep = new Data_Deep($this->_store); |
$deep = new Data_Deep($this->_store); |
104 |
$deep->set($var, $val); |
$deep->set($var, $val); |
105 |
} |
} |
106 |
|
|
107 |
function getVar($var) { |
function get_absolute($var) { |
108 |
//$this->_store[runtime][$var] = $val; |
//$this->_store[runtime][$var] = $val; |
109 |
//$deep = new Data_Deep($this->_store[runtime]); |
//$deep = new Data_Deep($this->_store[runtime]); |
110 |
$deep = new Data_Deep($this->_store); |
$deep = new Data_Deep($this->_store); |