指定 headers 头部信息

@param array $headers

@return static
498401
public function withHeaders(array $headers)
    {
        $clone = clone $this;

        foreach ($headers as $name => $value) {
            $clone->headers->set($name, $value);
        }

        return $clone;
    }
1047284
private function getHeaders(array $headers)
    {
        $str = '';
        foreach ($headers as $key => $value) {
            $str .= sprintf("%s: %s\r\n", $key, $value);
        }

        return $str;
    }
1254920
public function setHeaders(array $headers)
    {
        $this->headerRemove();
        
        foreach ($headers as $name => $values) {
            foreach ((array)$values as $value) {
                $this->header("$name: $value", false);
            }
        }
    }
628095
public function generateRawHeaders(array $headers)
    {
        $rawHeaders = array();
        foreach ($headers as $key => $values) {
            if (!is_array($values)) {
                $values = array($values);
            }
            foreach ($values as $value) {
                if ($key !== 0) {
                    $rawHeader =  $key . ': ' . $value;
                } else {
                    $rawHeader = $value;
                }
                foreach (explode("\r\n", $rawHeader) as $singleLineRawHeader) {
                    $rawHeaders[] = $singleLineRawHeader;
                }
            }
        }
        return $rawHeaders;
    }
352972
protected function incrementHeaders(array $headers)
    {
        $incrementedHeaders = [];
        foreach (array_count_values($headers) as $header => $count) {
            if ($count > 1) {
                $incrementedHeaders[] = $header;
                for ($i = 1; $i < $count; $i++) {
                    $incrementedHeaders[] = $header . $i;
                }
            } else {
                $incrementedHeaders[] = $header;
            }
        }

        return $incrementedHeaders;
    }
1000897
private function getHttpHearders(array $headers)
    {
        $http_headers = array();
        foreach ($headers as $key => $value) {
            array_push($http_headers, $key . ":" . $value);
        }
        return $http_headers;
    }
904325
private function setHeaders(array $headers)
    {
        if ( ! empty($headers))
        {
            $this->setOption(CURLOPT_HTTPHEADER, $this->optionParser->parseHeaders($headers));
        }
        else
        {
            $this->unsetOption(CURLOPT_HTTPHEADER);
        }
    }
277624
public function setHeaders(array $headers)
    {
        $headers = array_values($headers);
        if (!empty($headers) && !is_array($headers[0])) {
            $headers = array($headers);
        }

        $this->headersCopy = $headers;

        return parent::setHeaders($headers);
    }
93240
public function setMany(array $headers)
    {
        $this->clear();

        foreach ($headers as $header) {
            $this->append($header);
        }

        return $this;
    }
616784
public function setHeader(array $header)
    {
        if (is_numeric(key($header))) {
            $header = array_fill_keys($header, '');
        }
        $this->header = $header;

        return $this;
    }
1333821
private function rebuildHeader(array $headers)
    {
        $header = [];

        foreach ($headers as $entry) {
            $header[$entry['name']][] = $entry['value'];
        }

        return $header;
    }
353982
public function header(array $headers) {

        $formattedHeaders = [];

        $combinedHeaders = array_change_key_case(array_merge($this->header, $headers));

        foreach ($combinedHeaders as $key => $val)

            $formattedHeaders[] = trim(strtolower($key)) . ':' . $val;

        $this->header = $formattedHeaders;

        return $this;

    }
669062
private function cleanHeaders(array $headers)
    {
        $cleaned = [];

        foreach ($headers as $header => $value) {
            if (is_array($value)) {
                $value = array_map('strval', $value);
            } else {
                $value = [(string) $value];
            }

            $cleaned[strtolower($header)] = $value;
        }

        return $cleaned;
    }
1166750
public function setHeaders(array $headers)
	{
		foreach ($headers as $key => $header) {
			$this->setHeader($key, $header);
		}

		return $this;
	}
612501
private function normalizeHeaders($headers)
    {
        if (is_array($headers)) {
            $headers = new Headers($headers);
        } elseif (!($headers instanceof Headers)) {
            throw new InvalidArgumentException(
                'Headers must be an array or instance of Headers'
            );
        }

        return $headers;
    }
1281279
public function setHeader($header)
    {
        $headers = [];

        if (is_array($header)) {
            foreach ($header as $key => $value) {
                $headers[] = $key . ': ' . $value;
            }
        } else {
            $headers[] = $header;
        }

        $this->setOpt(CURLOPT_HTTPHEADER, $headers);

        return $this;
    }
269787
public function setHeaders(array $headers, $reset = false)
    {
        if ($reset === true) {
            $this->api_headers = $headers;
        } else {
            $this->api_headers += $headers;
        }

        return $this;
    }