/[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.3 by joko, Mon Feb 3 14:41:21 2003 UTC revision 1.7 by joko, Tue Mar 11 00:12:45 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     * @name Application::Config
7     *
8     */
9    
10    
11  // ---------------------------------------------------------------------------  // ---------------------------------------------------------------------------
12  //  $Id$  //  $Id$
13  // ---------------------------------------------------------------------------  // ---------------------------------------------------------------------------
14  //  $Log$  //  $Log$
15    //  Revision 1.7  2003/03/11 00:12:45  joko
16    //  + fixed metadata for phpDocumentor
17    //
18    //  Revision 1.6  2003/03/10 23:45:29  joko
19    //  + fixed metadata for phpDocumentor
20    //
21    //  Revision 1.5  2003/03/03 21:11:01  joko
22    //  mungled the namespaces
23    //
24    //  Revision 1.4  2003/02/09 17:03:35  joko
25    //  + additional get-/setter methods
26    //
27  //  Revision 1.3  2003/02/03 14:41:21  joko  //  Revision 1.3  2003/02/03 14:41:21  joko
28  //  + get- and set-methods to access configuration variables  //  + get- and set-methods to access configuration variables
29  //  + recursive merging mechanism  //  + recursive merging mechanism
# Line 33  Line 54 
54  */  */
55    
56    
57    /**
58     * --- Application_Config
59     *
60     * @author Andreas Motl <andreas.motl@ilo.de>
61     * @package org.netfrag.glib
62     * @subpackage Application
63     * @name Application::Config
64     *
65     */
66  class Application_Config {  class Application_Config {
67        
68    var $_store;    var $_store;
# Line 45  class Application_Config { Line 75  class Application_Config {
75        
76    function merge() {    function merge() {
77      //$this->_store[run] = array_merge($this->_store['default'], $this->_store['init']);      //$this->_store[run] = array_merge($this->_store['default'], $this->_store['init']);
78    //print Dumper($this);
79      foreach ($this->_store[_init][configkeys] as $configKey) {      foreach ($this->_store[_init][configkeys] as $configKey) {
80        //$this->_store[runtime] = array_merge($this->_store[runtime], $this->_store[$configKey]);        //$this->_store[runtime] = array_merge($this->_store[runtime], $this->_store[$configKey]);
81        //$this->_store[runtime] = array_merge_recursive($this->_store[runtime], $this->_store[$configKey]);        //$this->_store[runtime] = array_merge_recursive($this->_store[runtime], $this->_store[$configKey]);
82        $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]);
83      }      }
84      //print Dumper($this);      //print Dumper($this);
85    }    }
86        
87    function getPart($var = null) {    function get($var = null) {
88      //$this->merge();      //$this->merge();
89      if ($var) {      if ($var) {
90        return $this->getVar("runtime.$var");        return $this->get_absolute("runtime.$var");
91      } else {      } else {
92        return $this->getVar("runtime");        return $this->get_absolute("runtime");
93      }      }
94    }    }
95        
96    function setVar($var, $val) {    function set_absolute($var, $val) {
97      //$this->_store[runtime][$var] = $val;      //$this->_store[runtime][$var] = $val;
98      //$deep = new Data_Deep($this->_store[runtime]);      //$deep = new Data_Deep($this->_store[runtime]);
99      $deep = new Data_Deep($this->_store);      $deep = new Data_Deep($this->_store);
100      $deep->set($var, $val);      $deep->set($var, $val);
101    }    }
102        
103    function getVar($var) {    function get_absolute($var) {
104      //$this->_store[runtime][$var] = $val;      //$this->_store[runtime][$var] = $val;
105      //$deep = new Data_Deep($this->_store[runtime]);      //$deep = new Data_Deep($this->_store[runtime]);
106      $deep = new Data_Deep($this->_store);      $deep = new Data_Deep($this->_store);

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.7

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