/** * Parses the PHP array recursively * @param array $array array values from the config file * @param object $container reference to the container object * @access private * @return void */ function _parseArray($array, &$container) { foreach ($array as $key => $value) { switch ((string) $key) { case '@': $container->setAttributes($value); break; case '#': $container->setType('directive'); $container->setContent($value); break; default: /* if (is_array($value)) { $section =& $container->createSection($key); $this->_parseArray($value, $section); } else { $container->createDirective($key, $value); }*/ if (is_array($value)) { if (is_integer(key($value))) { foreach ($value as $nestedValue) { if (is_array($nestedValue)) { $section =& $container->createSection($key); $this->_parseArray($nestedValue, $section); } else { $container->createDirective($key, $nestedValue); } } } else { $section =& $container->createSection($key); $this->_parseArray($value, $section); } } else { $container->createDirective($key, $value); } } } }
/** * Parses the PHP array recursively * @param array $array array values from the config file * @param object $container reference to the container object * @access private * @return void */ function _parseArray($array, &$container) { foreach ($array as $key => $value) { switch ((string) $key) { case '@': $container->setAttributes($value); break; case '#': $container->setType('directive'); $container->setContent($value); break; default: if (is_array($value)) { if ($this->options['duplicateDirectives'] == true && is_integer(key($value)) && 1 == count(array_unique(array_map('is_numeric', array_keys($value))))) { foreach ($value as $nestedValue) { if (is_array($nestedValue)) { $section =& $container->createSection($key); $this->_parseArray($nestedValue, $section); } else { $container->createDirective($key, $nestedValue); } } } else { $section =& $container->createSection($key); $this->_parseArray($value, $section); } } else { $container->createDirective($key, $value); } } } }