public function replace($key, $value = [])
    {
        if (is_array($key)) {
            $this->items = array_replace($this->items, $key);
        } elseif (is_string($key)) {
            $items = (array) $this->get($key);
            $value = array_replace($items, $this->getArrayItems($value));

            $this->set($key, $value);
        } elseif ($key instanceof self) {
            $this->items = array_replace($this->items, $key->all());
        }
    }
public function replace($key, $value = [])
    {
        if (is_array($key)) {
            $this->items = array_replace($this->items, $key);
        } elseif (is_string($key)) {
            $items = (array) $this->get($key);
            $value = array_replace($items, $this->getArrayItems($value));

            $this->set($key, $value);
        } elseif ($key instanceof self) {
            $this->items = array_replace($this->items, $key->all());
        }
    }
public function replace ( $ key , $ value = [ ] ) { if ( is_array ( $ key ) ) { $ this -> items = array_replace ( $ this -> items , $ key ) ; } elseif ( is_string ( $ key ) ) { $ items = ( array ) $ this -> get ( $ key ) ; $ value = array_replace ( $ items , $ this -> getArrayItems ( $ value ) ) ; $ this -> set ( $ key , $ value ) ; } elseif ( $ key instanceof self ) { $ this -> items = array_replace ( $ this -> items , $ key -> all ( ) ) ; } }
Replace all values or values within the given key
with an array or Dot object

@param array|string|self $key
@param array|self        $value
Replace all values or values within the given key with an array or Dot object