Пример #1
0
 /**
  * Constructor
  *
  * @param   string  $data  The raw parms text.
  * @param   string  $path  Path to the XML setup file.
  * @return  void
  */
 public function __construct($data = '', $path = '')
 {
     parent::__construct('_default');
     // Set base path.
     $this->_elementPath[] = __DIR__ . DS . 'Parameter' . DS . 'Element';
     if ($data = trim($data)) {
         $this->parse($data);
     }
     if ($path) {
         $this->loadSetupFile($path);
     }
     $this->_raw = $data;
 }
Пример #2
0
 /**
  * Create a new configuration repository.
  *
  * @param   string  $path
  * @return  void
  */
 public function __construct($path = null)
 {
     if (!$path) {
         $path = PATH_ROOT;
     }
     $this->file = $path . DS . 'configuration.php';
     if ($this->file) {
         $data = $this->read($this->file);
         $data = \Hubzero\Utility\Arr::fromObject($data);
         $config = array();
         foreach ($data as $key => $value) {
             foreach ($this->map as $group => $values) {
                 if (!isset($config[$group])) {
                     $config[$group] = array();
                 }
                 if (in_array($key, $values)) {
                     $config[$group][$key] = $value;
                 }
             }
         }
         parent::__construct($config);
     }
 }