public function replace($oldValue, $newValue)
    {
        if (!is_string($oldValue)) {
            throw new UnexpectedTypeException($oldValue, 'string', 'oldValue');
        }
        if (empty($oldValue)) {
            return;
        }
        if (!is_string($newValue) && null !== $newValue) {
            throw new UnexpectedTypeException($newValue, 'string or null', 'newValue');
        }

        $key = array_search($oldValue, $this->values, true);
        if (false !== $key) {
            if (empty($newValue)) {
                unset($this->values[$key]);
            } else {
                $this->values[$key] = $newValue;
            }
        }
    }
public function replace($oldValue, $newValue)
    {
        if (!is_string($oldValue)) {
            throw new UnexpectedTypeException($oldValue, 'string', 'oldValue');
        }
        if (empty($oldValue)) {
            return;
        }
        if (!is_string($newValue) && null !== $newValue) {
            throw new UnexpectedTypeException($newValue, 'string or null', 'newValue');
        }

        $key = array_search($oldValue, $this->values, true);
        if (false !== $key) {
            if (empty($newValue)) {
                unset($this->values[$key]);
            } else {
                $this->values[$key] = $newValue;
            }
        }
    }
public function replace ( $ oldValue , $ newValue ) { if ( ! is_string ( $ oldValue ) ) { throw new UnexpectedTypeException ( $ oldValue , 'string' , 'oldValue' ) ; } if ( empty ( $ oldValue ) ) { return ; } if ( ! is_string ( $ newValue ) && null !== $ newValue ) { throw new UnexpectedTypeException ( $ newValue , 'string or null' , 'newValue' ) ; } $ key = array_search ( $ oldValue , $ this -> values , true ) ; if ( false !== $ key ) { if ( empty ( $ newValue ) ) { unset ( $ this -> values [ $ key ] ) ; } else { $ this -> values [ $ key ] = $ newValue ; } } }
Requests to replace one value with another value

@param string      $oldValue
@param string|null $newValue
Requests to replace one value with another value