src/CarteBlanche/App/Config.php
public function set(array $config, $merge_globals = true, $stack_name = null)
    {
        if (!empty($config)) {
            $config = $this->_buildConfigStack($config);
            if (!empty($stack_name)) {
                $this->getRegistry()->loadStack($stack_name);
            }
            foreach ($config as $index=>$val) {
                $this->getRegistry()->setEntry($index, $val);
            }
            if (!empty($stack_name)) {
                $this->getRegistry()->saveStack($stack_name);
            }
        }

        if (!$merge_globals) {
            return $config;
        } else {
            $this->getRegistry()->loadStack(self::$global_config_id);
            $globals = array_replace_recursive(
                $this->getRegistry()->dump(), $config
            );
            foreach ($globals as $index=>$val) {
                $this->getRegistry()->setEntry($index, $val);
            }            
            $this->getRegistry()->saveStack(self::$global_config_id);
            return $this;
        }
    }
public function set(array $config, $merge_globals = true, $stack_name = null)
    {
        if (!empty($config)) {
            $config = $this->_buildConfigStack($config);
            if (!empty($stack_name)) {
                $this->getRegistry()->loadStack($stack_name);
            }
            foreach ($config as $index=>$val) {
                $this->getRegistry()->setEntry($index, $val);
            }
            if (!empty($stack_name)) {
                $this->getRegistry()->saveStack($stack_name);
            }
        }

        if (!$merge_globals) {
            return $config;
        } else {
            $this->getRegistry()->loadStack(self::$global_config_id);
            $globals = array_replace_recursive(
                $this->getRegistry()->dump(), $config
            );
            foreach ($globals as $index=>$val) {
                $this->getRegistry()->setEntry($index, $val);
            }            
            $this->getRegistry()->saveStack(self::$global_config_id);
            return $this;
        }
    }
Parse and set a configuration array

@param   array       $config
@param   bool        $merge_globals
@param   null/string $stack_name
@return  self/array  Returns the parsed array if `$merge_globals` is false, the config object otherwise