code: public function editQuery($name, $value)
      {
          $parts = explode('&', $this->_urlParts['query']);
          $return = [];
          foreach ($parts as $p) {
              $paramData = explode('=', $p);
              if ($paramData[0] === $name) {
                  $paramData[1] = $value;
              }
              $return[] = implode('=', $paramData);
          }
  
          $this->_urlParts['query'] = implode('&', $return);
  
          return $this;
      }
docs: Edit existing query parameter
  
  @param string $name Parameter name
  @param string $value New value
  @return $this