public function merge(Config $merge)
    {
        /** @var Config $value */
        foreach ($merge as $key => $value) {
            if (array_key_exists($key, $this->data)) {
                if (is_int($key)) {
                    $this->data[] = $value;
                } elseif ($value instanceof self && $this->data[$key] instanceof self) {
                    $this->data[$key]->merge($value);
                } else {
                    if ($value instanceof self) {
                        $this->data[$key] = new static($value->toArray(), $this->allowModifications);
                    } else {
                        $this->data[$key] = $value;
                    }
                }
            } else {
                if ($value instanceof self) {
                    $this->data[$key] = new static($value->toArray(), $this->allowModifications);
                } else {
                    $this->data[$key] = $value;
                }

                $this->count++;
            }
        }

        return $this;
    }
public function merge(Config $merge)
    {
        /** @var Config $value */
        foreach ($merge as $key => $value) {
            if (array_key_exists($key, $this->data)) {
                if (is_int($key)) {
                    $this->data[] = $value;
                } elseif ($value instanceof self && $this->data[$key] instanceof self) {
                    $this->data[$key]->merge($value);
                } else {
                    if ($value instanceof self) {
                        $this->data[$key] = new static($value->toArray(), $this->allowModifications);
                    } else {
                        $this->data[$key] = $value;
                    }
                }
            } else {
                if ($value instanceof self) {
                    $this->data[$key] = new static($value->toArray(), $this->allowModifications);
                } else {
                    $this->data[$key] = $value;
                }

                $this->count++;
            }
        }

        return $this;
    }
public function merge ( Config $ merge ) { /** @var Config $value */ foreach ( $ merge as $ key => $ value ) { if ( array_key_exists ( $ key , $ this -> data ) ) { if ( is_int ( $ key ) ) { $ this -> data [ ] = $ value ; } elseif ( $ value instanceof self && $ this -> data [ $ key ] instanceof self ) { $ this -> data [ $ key ] -> merge ( $ value ) ; } else { if ( $ value instanceof self ) { $ this -> data [ $ key ] = new static ( $ value -> toArray ( ) , $ this -> allowModifications ) ; } else { $ this -> data [ $ key ] = $ value ; } } } else { if ( $ value instanceof self ) { $ this -> data [ $ key ] = new static ( $ value -> toArray ( ) , $ this -> allowModifications ) ; } else { $ this -> data [ $ key ] = $ value ; } $ this -> count ++ ; } } return $ this ; }
Merge another Config with this one.

For duplicate keys, the following will be performed:
- Nested Configs will be recursively merged.
- Items in $merge with INTEGER keys will be appended.
- Items in $merge with STRING keys will overwrite current values.

@param  Config $merge
@return Config
Merge another Config with this one .