src/CarteBlanche/App/Config.php
protected function _buildConfigStack(array $config_array)
    {
        $config = array();
        foreach ($config_array as $index=>$val) {
            $index = $this->_slugify($index);
            $val = $this->_treatValue($val);

            if (strpos($index, self::$depth_separator_char)!==false) {
                $depth_index = explode(self::$depth_separator_char, $index);
                $tmp_conf =& $config;
                foreach ($depth_index as $count=>$_i) {
                    if (!array_key_exists($_i, $tmp_conf)) {
                        $tmp_conf[$_i] = array();
                    }
                    $tmp_conf =& $tmp_conf[$_i];
                    if ($count===count($depth_index)-1) {
                        $tmp_conf = $val;
                    }
                }
                unset($config[$index]);
            } else {
                if (is_array($val)) {
                    foreach ($val as $val_index=>$val_val) {
                        if (strpos($val_index, self::$depth_separator_char)!==false) {
                            $val = $this->_buildConfigStack($val);
                        }
                    }
                }
                $config[$index] = $val;
            }
        }
        return $config;
    }
protected function _buildConfigStack(array $config_array)
    {
        $config = array();
        foreach ($config_array as $index=>$val) {
            $index = $this->_slugify($index);
            $val = $this->_treatValue($val);

            if (strpos($index, self::$depth_separator_char)!==false) {
                $depth_index = explode(self::$depth_separator_char, $index);
                $tmp_conf =& $config;
                foreach ($depth_index as $count=>$_i) {
                    if (!array_key_exists($_i, $tmp_conf)) {
                        $tmp_conf[$_i] = array();
                    }
                    $tmp_conf =& $tmp_conf[$_i];
                    if ($count===count($depth_index)-1) {
                        $tmp_conf = $val;
                    }
                }
                unset($config[$index]);
            } else {
                if (is_array($val)) {
                    foreach ($val as $val_index=>$val_val) {
                        if (strpos($val_index, self::$depth_separator_char)!==false) {
                            $val = $this->_buildConfigStack($val);
                        }
                    }
                }
                $config[$index] = $val;
            }
        }
        return $config;
    }
Rebuild a configuration array

This will slugify all indexes and dispatch values following the dotted indexes.

@param   array   $config_array
@return  array