Sets custom header value to the message.
@param string $name header name.
@param string|array $value header value or values.
@return $this self reference.
@since 2.0.6
777805
public function setHeader($name, $value)
    {
        $headerSet = $this->getSwiftMessage()->getHeaders();

        if ($headerSet->has($name)) {
            $headerSet->remove($name);
        }

        foreach ((array)$value as $v) {
            $headerSet->addTextHeader($name, $v);
        }

        return $this;
    }
173766
public function setHeader(string $name, $value) : Message
    {
        $name = strtolower($name);
        $this->headers[$name] = is_array($value) ? array_values($value) : [$value];

        return $this;
    }
475820
public function addHeader($name, $value)
    {
        $this->getSwiftMessage()->getHeaders()->addTextHeader($name, $value);
        return $this;
    }
322241
public function setHeader(string $name, string $value)
    {
        // Make sure the word has no spaces but dashes instead, and is
        // Camel-Cased. The dashes are first replaced with spaces to let
        // ucwords function properly, and afterwards all spaces are converted
        // to dashes.
        $name = ucwords(strtolower(str_replace('-', ' ', $name)));
        $name = str_replace(' ', '-', $name);

        $this->headers[$name] = $value;
        return $this;
    }
1297871
public function addHeader(string $name, $value)
    {
        $lName = strtolower($name);
        if (isset($this->headers[$lName])) {
            $this->headers[$lName][1] = array_merge(
                $this->headers[$lName][1],
                (array) $value
            );
        } else {
            $this->headers[$lName] = [
                $name,
                (array) $value,
            ];
        }
    }
616715
public function setRequestHeader($name, $value)
    {
        if (!is_string($name))
            throw new \InvalidArgumentException('Argument 1 expected to be string, '.gettype($name).' seen.');

        if (!is_string($value))
            throw new \InvalidArgumentException('Argument 2 expected to be string, '.gettype($value).' seen.');

        if (($name = trim($name)) === '')
            throw new \RuntimeException('Argument 1 cannot be empty string.');

        $this->requestHeaders[$name] = $value;

        return $this;
    }
843874
public function set($name, $value): self
    {
        if (!\is_array($value)) {
            $value = ['value' => (string)$value];
        }

        parent::set($name, \array_replace($this->defaults, $value));

        return $this;
    }
947972
public function setPost(string $name, $value) : self
    {
        $this->post[$name] = $value;

        return $this;
    }
1093011
public function withAddedHeader($name, $value)
    {
        $instance = clone $this;
        $instance->headers->add($name, $value);
        return $instance;
    }
86220
public function addHeader(string $name, string $value) : self
    {
        $name = $this->normalizeHeader($name);
        if (isset($this->headers[$name])) {
            throw new \InvalidArgumentException(
                sprintf("Header %s is already set with value '%s'", $name, $this->headers[$name])
            );
        }

        $this->headers[$name] = $value;

        return $this;
    }
728508
public function addHeader(string $name, string $value): Response
    {
        $this->headers->add($name, $value);
        return $this;
    }
220400
public function add(string $name, $value): self
    {
        $this->headers[$name] = $value;
        return $this;
    }
141641
public function addVarnishHeader($name, $value)
    {
        $header = $value;
        
        if ($this->hasVarnishHeader($name)) {
            $header = $this->getVarnishHeader($name);
            
            if (!is_array($header)) {
                $header = array($header);
            }
            
            $header[] = $value;
        } 
        
        $this->setVarnishHeader($name, $header);
        
        return $this;
    }
423023
public function setHeader(string $name, string $value)
    {
        switch ($this->type) {
            case 'psr-7':
                $this->response = $this->response->withHeader($name, $value);
                break;

            case 'laravel':
            case 'symfony':
                $this->response->headers->set($name, $value);
                break;

            case 'thinkphp':
                $this->response->header($name, $value);
                break;

            default:
                $this->response[$name] = $value;
                break;
        }

        return $this;
    }
824271
final public function setParameter(string $name, $value) : self
    {
        $this->parameters[$name] = $value;
        return $this;
    }
628685
public function set($name, $value = null): self
    {
        if (!is_array($name)) {
            $name = [$name => $value];
        }

        foreach ($name as $property => $value) {
            $this->_data[$property] = $value;
        }

        return $this;
    }
578501
protected function setHeader(string $name, $value)
    {
        if (!$this->isHeaderNameValid($name)) {
            throw new InvalidHeaderException('Header name is invalid.');
        }

        $normalized = strtolower($name);
        $value = $this->filterHeader($value);

        // Header may have been previously set with a different case. If so, remove that header.
        if (isset($this->headerNameMap[$normalized]) && $this->headerNameMap[$normalized] !== $name) {
            unset($this->headers[$this->headerNameMap[$normalized]]);
        }

        $this->headerNameMap[$normalized] = $name;
        $this->headers[$name] = $value;
    }