Esempio n. 1
0
 private function setValues($ini, &$data = null)
 {
     if ($ini) {
         if (!isset($data)) {
             $data =& $this->data;
         }
         foreach ($ini as $name => $value) {
             if (is_array($value) || is_object($value)) {
                 if (!isset($data[$name])) {
                     $data[$name] = array();
                 }
                 $this->setValues($value, $data[$name]);
             } else {
                 $value = preg_replace_callback('#\\$\\{([A-Z0-9_]+)(\\.([A-Z0-9_]+))?\\}#i', function ($match) {
                     $name = strtoupper($match[1] . (isset($match[3]) ? '_' . $match[3] : ''));
                     if (defined($name)) {
                         return constant($name);
                     } else {
                         if (isset($match[3])) {
                             $data = Arr::getTree($this->data, $match[1]);
                             $var = $match[3];
                         } else {
                             $data = $this->data;
                             $var = $match[1];
                         }
                         return Arr::getTree($data, $var);
                     }
                 }, $value);
                 Arr::setTree($data, array($name => $value));
             }
         }
     }
 }
Esempio n. 2
0
 public function info($name = false)
 {
     return Arr::getTree($this->info, $name);
 }