src/CarteBlanche/App/Config.php
public function get($index, $flag = self::NOT_FOUND_GRACEFULLY, $default = null, $stack_name = 'global')
    {
        $value = null;
        if ($stack_name==='global') {
            $config = $this->getRegistry()->dumpStack(self::$global_config_id);
        } else {
            if ($this->getRegistry()->isStack($stack_name)) {
                $config = $this->getRegistry()->dumpStack($stack_name);
            } else {
                if ($flag & self::NOT_FOUND_ERROR) {
                    throw new InvalidArgumentException(
                        sprintf('Unknown configuration stack "%s"!', $stack_name)
                    );
                } else {
                    return $default;
                }
            }
        }

        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 =& $tmp_conf[$_i];
                } else {
                    if ($count===0) {
                        $stack_name = array_shift($depth_index);
                        return $this->get(
                            implode(self::$depth_separator_char, $depth_index),
                            $flag, $default, $stack_name
                        );
                    }
                    $tmp_conf = array();
                }
            }
            if (!empty($tmp_conf)) {
                $value = $this->_parseConfig($tmp_conf, $stack_name);
            }
        } else {
            if (array_key_exists($index, $config)) {
                $value = $this->_parseConfig($config[$index], $stack_name);
            }
        }

        if (!$value) {
            if ($flag & self::NOT_FOUND_GRACEFULLY) {
                return $default;
            } else {
                throw new InvalidArgumentException(
                    sprintf('Unknown configuration entry "%s"!', $index)
                );
            }
        } else {
            return $value;
        }
    }
public function get($index, $flag = self::NOT_FOUND_GRACEFULLY, $default = null, $stack_name = 'global')
    {
        $value = null;
        if ($stack_name==='global') {
            $config = $this->getRegistry()->dumpStack(self::$global_config_id);
        } else {
            if ($this->getRegistry()->isStack($stack_name)) {
                $config = $this->getRegistry()->dumpStack($stack_name);
            } else {
                if ($flag & self::NOT_FOUND_ERROR) {
                    throw new InvalidArgumentException(
                        sprintf('Unknown configuration stack "%s"!', $stack_name)
                    );
                } else {
                    return $default;
                }
            }
        }

        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 =& $tmp_conf[$_i];
                } else {
                    if ($count===0) {
                        $stack_name = array_shift($depth_index);
                        return $this->get(
                            implode(self::$depth_separator_char, $depth_index),
                            $flag, $default, $stack_name
                        );
                    }
                    $tmp_conf = array();
                }
            }
            if (!empty($tmp_conf)) {
                $value = $this->_parseConfig($tmp_conf, $stack_name);
            }
        } else {
            if (array_key_exists($index, $config)) {
                $value = $this->_parseConfig($config[$index], $stack_name);
            }
        }

        if (!$value) {
            if ($flag & self::NOT_FOUND_GRACEFULLY) {
                return $default;
            } else {
                throw new InvalidArgumentException(
                    sprintf('Unknown configuration entry "%s"!', $index)
                );
            }
        } else {
            return $value;
        }
    }
Get a configuration stack or entry

@param   string      $index
@param   int         $flag
@param   null/mixed   $default
@param   string      $stack_name
@return  mixed
@throws  \CarteBlanche\Exception\InvalidArgumentException if the index doesn't exist and `$flag` is NOT_FOUND_ERROR