protected function merge($key, $result)
    {
        if (is_null($key)) {

            // key is null, so just merge with root
            $this->config = array_merge($this->config, $result);

        } elseif (strpos($key, '.') === false) {

            // non-compound key, just merge key with incoming data
            if (!isset($this->config[$key]) && !array_key_exists($key, $this->config)) {
                throw new KeyDoesNotExistException($key);
            }

            // if $this->config[$key] is not an array, we convert it one before merging
            if (!is_array($this->config[$key])) {
                $this->config[$key] = [];
            }

            $this->config[$key] = array_merge($this->config[$key], $result);

        } else {

            // compound key, so merge with parent reference
            list($parent, $child) = $this->getParentChildKeys($key);
            $config = $this->resolveKey($parent);
            $config[$child] = array_merge($config[$child], $result);

        }
    }
protected function merge($key, $result)
    {
        if (is_null($key)) {

            // key is null, so just merge with root
            $this->config = array_merge($this->config, $result);

        } elseif (strpos($key, '.') === false) {

            // non-compound key, just merge key with incoming data
            if (!isset($this->config[$key]) && !array_key_exists($key, $this->config)) {
                throw new KeyDoesNotExistException($key);
            }

            // if $this->config[$key] is not an array, we convert it one before merging
            if (!is_array($this->config[$key])) {
                $this->config[$key] = [];
            }

            $this->config[$key] = array_merge($this->config[$key], $result);

        } else {

            // compound key, so merge with parent reference
            list($parent, $child) = $this->getParentChildKeys($key);
            $config = $this->resolveKey($parent);
            $config[$child] = array_merge($config[$child], $result);

        }
    }
protected function merge ( $ key , $ result ) { if ( is_null ( $ key ) ) { // key is null, so just merge with root $ this -> config = array_merge ( $ this -> config , $ result ) ; } elseif ( strpos ( $ key , '.' ) === false ) { // non-compound key, just merge key with incoming data if ( ! isset ( $ this -> config [ $ key ] ) && ! array_key_exists ( $ key , $ this -> config ) ) { throw new KeyDoesNotExistException ( $ key ) ; } // if $this->config[$key] is not an array, we convert it one before merging if ( ! is_array ( $ this -> config [ $ key ] ) ) { $ this -> config [ $ key ] = [ ] ; } $ this -> config [ $ key ] = array_merge ( $ this -> config [ $ key ] , $ result ) ; } else { // compound key, so merge with parent reference list ( $ parent , $ child ) = $ this -> getParentChildKeys ( $ key ) ; $ config = $ this -> resolveKey ( $ parent ) ; $ config [ $ child ] = array_merge ( $ config [ $ child ] , $ result ) ; } }
Merge values into a key.

@param string $key The key to merge into
@param mixed $result The data to merge
@throws KeyDoesNotExistException If the key doesn't exist
Merge values into a key .