protected function &resolveKey($key)
    {
        // check if the key is a compound key
        if (strpos($key, '.') !== false) {

            // key is compound, so split it into parts
            $parts = explode('.', $key);
            $config = &$this->config;

            // recurse into the config array using the key parts
            while (is_array($config) && ($part = array_shift($parts)) !== null) {
                if (!isset($config[$part]) && array_key_exists($part, $config)) {
                    throw new KeyDoesNotExistException($key);
                }
                $config = &$config[$part];
            }

            // if there are still key parts left, then the key doesn't exist
            if (count($parts) > 0) {
                throw new KeyDoesNotExistException($key);
            }

        } else {

            // key is not compound, so just check if it exists and get value
            if (!isset($this->config[$key]) && !array_key_exists($key, $this->config)) {
                throw new KeyDoesNotExistException($key);
            }
            $config = &$this->config[$key];

        }

        return $config;
    }