public function merge(ConfigContainer $other): ConfigContainer
    {
        if ($this->isFrozen()) {
            throw new FrozenContainerException('Container is frozen');
        }
        if ($other->isFrozen()) {
            throw new FrozenContainerException('Container is frozen');
        }

        foreach ($other as $name => $value) {
            if (!array_key_exists($name, $this->data)) {
                $this->data[$name] = $value;
            } else {
                if (is_int($name)) {
                    $this->data[] = $value;
                } elseif ($value instanceof self && $this->data[$name] instanceof self) {
                    $this->data[$name]->merge($value);
                } else {
                    $this->data[$name] = $value;
                }
            }
        }

        return $this;
    }
public function merge(ConfigContainer $other): ConfigContainer
    {
        if ($this->isFrozen()) {
            throw new FrozenContainerException('Container is frozen');
        }
        if ($other->isFrozen()) {
            throw new FrozenContainerException('Container is frozen');
        }

        foreach ($other as $name => $value) {
            if (!array_key_exists($name, $this->data)) {
                $this->data[$name] = $value;
            } else {
                if (is_int($name)) {
                    $this->data[] = $value;
                } elseif ($value instanceof self && $this->data[$name] instanceof self) {
                    $this->data[$name]->merge($value);
                } else {
                    $this->data[$name] = $value;
                }
            }
        }

        return $this;
    }
public function merge ( ConfigContainer $ other ) : ConfigContainer { if ( $ this -> isFrozen ( ) ) { throw new FrozenContainerException ( 'Container is frozen' ) ; } if ( $ other -> isFrozen ( ) ) { throw new FrozenContainerException ( 'Container is frozen' ) ; } foreach ( $ other as $ name => $ value ) { if ( ! array_key_exists ( $ name , $ this -> data ) ) { $ this -> data [ $ name ] = $ value ; } else { if ( is_int ( $ name ) ) { $ this -> data [ ] = $ value ; } elseif ( $ value instanceof self && $ this -> data [ $ name ] instanceof self ) { $ this -> data [ $ name ] -> merge ( $ value ) ; } else { $ this -> data [ $ name ] = $ value ; } } } return $ this ; }
Merges another config container

Behavior for duplicate keys:
- Nested containers are merged recursively
- Values with integer keys are appended
- Values with string keys will overwrite

@param ConfigContainer $other The container to merge

@return ConfigContainer

@throws FrozenContainerException When either container is frozen
Merges another config container