Adds a query variable and value, replacing the value if it
already exists and returning the old value.

@param   string  $name   Name of the query variable to set.
@param   string  $value  Value of the query variable.
@return  object  $this
976275
public function setVar($name, $value)
	{
		$this->vars[$name] = $value;

		$this->query = null;

		return $this;
	}
1340106
public function addQuery($key, $value = null)
    {
        //if it's an array
        if (is_array($key)) {
            //warning this overwrites existing headers
            $this->query = $key;
            return $this;
        }

        //else it should be key value
        $this->query[$key] =  $value;
        return $this;
    }
318151
public function addArgument($name, $value)
    {
        if (!isset($this->arguments[$name])) {
            $this->arguments[$name] = $value;
        }

        return $this;
    }
1064875
public function withParameter(string $name, ?string $value): self
    {
        if ($value !== null) {
            $this->parameters[$name] = $value;

        } else {
            unset($this->parameters[$name]);
        }

        return $this;
    }
686808
public function addHeader($name, $value = null)
    {
        if (is_numeric($name)) {
            $status = $this->getStatus($name);
            if (!empty($status)) {
                $this->headers[] = "{$_SERVER['SERVER_PROTOCOL']} $name $status";
            }
        } elseif (isset($value)) {
            $this->headers[] = "$name: $value";
        }

        return $this;
    }
1169471
public function addGet($name, $value = null)
    {
        if (is_array($name) && $value === null) {
            $this->getParams = array_merge($this->getParams, $name);
        } else {
            $this->getParams[$name] = $value;
        }

        return $this;
    }
251067
public function set($name, $value)
    {
        //If it's an object, save its ID as the parameter
        if(is_object($value) && method_exists($value, 'getId'))
        {
            $this->parameters[$name] = $value->getId();
        }

        //Just save the parameter
        else
        {
            $this->parameters[$name] = $value;
        }

        return $this;
    }
1006807
public function addQueryParameter($name, $value)
    {
        if ($this->method === Utils::$METHOD_GET)
        {
            if (!$this->hasGetPostParamValue($name, true))
            {
                $this->addGetParameter($name, $value);
                return true;
            }
            else
            {
                return false;
            }
        }
        else if ($this->method === Utils::$METHOD_POST)
        {
            if (!$this->hasGetPostParamValue($name, true))
            {
                $this->addPostParameter($name, $value);
                return true;
            }
            else
            {
                return false;
            }
        }
        return null;
    }
185520
public function set($name, $value)
    {
        $name = '_' . (string)$name;
        if (property_exists($this, $name) && (!is_array($this->$name))) {
            $this->$name = $value;
        }
        return $this;
    }
1221367
public function setFieldValue($name, $value)
    {
        foreach ($this->fields as $key => $fields) {
            if (isset($fields[$name])) {
                $this->fields[$key][$name]->setValue($value);
            }
        }
        return $this;
    }
311898
public function parameter(string $name, $value): HttpRequest
    {
        $this->parameters[$name] = $value;

        return $this;
    }
1324028
public function setQueryParameter($name, $value)
    {
        $this->query_array[$name] = $value;
        $this->query = http_build_query($this->query_array);
        return $this;
    }
825228
public function withAttribute($name, $value)
    {
        $attributes = $this->getAttributes();
        if (array_key_exists($name, $attributes) && $attributes[$name] === $value) {
            return $this;
        }

        $attributes[$name] = $value;

        $newInstance = clone $this;
        $newInstance->setAttributes($attributes);
        return $newInstance;
    }
921305
public function addExtraConfiguration($name, $value)
    {
        $name = $this->resolveString($name, __METHOD__);
        $this->extraConfiguration[$name] = $value;

        return $this;
    }
527350
final public function set($name, $value)
    {
        $method = 'set'.ucfirst($name);
        if(!method_exists($this, $method) ) {
            parent::set($name, $value);
        } else {
            $this->$method($value);
        }

        return $this;
    }
1289829
public function forgetValue($name, $value)
    {
        if ($this->has($name)) {
            $attr = $this->getAttr($name);

            $attr->forgetValue($value);
        }

        return $this;
    }
286511
public function addAttr($name, $value)
    {
        if (!in_array($name, $this->attributes)) {
            $this->attributes[$name] = $value;
        }
        return $this;
    }