private function merge(array $merged, array $array)
    {
        foreach ($array as $key => $value) {
            if (is_array($value) && isset ($merged[$key]) && is_array($merged[$key])) {
                $merged[$key] = $this->merge($merged[$key], $value);
            } else {
                $merged[$key] = $value;
            }
        }

        return $merged;
    }
private function merge(array $merged, array $array)
    {
        foreach ($array as $key => $value) {
            if (is_array($value) && isset ($merged[$key]) && is_array($merged[$key])) {
                $merged[$key] = $this->merge($merged[$key], $value);
            } else {
                $merged[$key] = $value;
            }
        }

        return $merged;
    }
private function merge ( array $ merged , array $ array ) { foreach ( $ array as $ key => $ value ) { if ( is_array ( $ value ) && isset ( $ merged [ $ key ] ) && is_array ( $ merged [ $ key ] ) ) { $ merged [ $ key ] = $ this -> merge ( $ merged [ $ key ] , $ value ) ; } else { $ merged [ $ key ] = $ value ; } } return $ merged ; }
Merges arrays without changing duplicated keys into arrays

@param array $merged
@param array $array

@return array
Merges arrays without changing duplicated keys into arrays