@param array $complete_headers

@return \Jose\Algorithm\KeyEncryptionAlgorithmInterface
967485
private function getKeyEncryptionAlgorithm(array $complete_headers)
    {
        $this->log(LogLevel::DEBUG, 'Trying to find key encryption algorithm');
        $key_encryption_algorithm = $this->getJWAManager()->getAlgorithm($complete_headers['alg']);
        if (!$key_encryption_algorithm instanceof KeyEncryptionAlgorithmInterface) {
            $exception = new \InvalidArgumentException(sprintf('The key encryption algorithm "%s" is not supported or does not implement KeyEncryptionAlgorithmInterface.', $complete_headers['alg']));
            $this->log(LogLevel::ERROR, 'The key encryption algorithm {alg} is not supported or does not implement KeyEncryptionAlgorithmInterface.', ['alg' => $complete_headers['alg'], 'exception' => $exception]);
            throw $exception;
        }

        $this->log(LogLevel::DEBUG, 'Key encryption algorithm {algorithm} found', ['algorithm' => $complete_headers['alg'], 'service' > $key_encryption_algorithm]);

        return $key_encryption_algorithm;
    }
528550
protected function buildStructuredHeaders(): void
    {
        $this->structuredHeaders = array();
        $headers = $this->entry[PoTokens::TRANSLATED];
        $headers = ($headers === null) ? array() : $headers;
        $full = implode('', $headers);
        $headers = explode("\n", $full);
        // split on ':'
        $pattern = '/([a-z0-9\-]+):\s*(.*)/i';
        foreach ($headers as $h) {
            if (preg_match($pattern, trim($h), $matches)) {
                $this->structuredHeaders[strtolower($matches[1])] = array(
                    'key' => $matches[1],
                    'value' => $matches[2],
                );
            }
        }
    }
91022
public function sendHeaders()
	{
		// Early return if headers already have been send
		if (headers_sent()) {
			return $this;
		}

		foreach ($this->headers as $key => $value) {
			header(
				sprintf('%s: %s', $key, is_array($value) ? implode('; ', $value) : $value),
				true,
				$this->statusCode
			);
		}

		header(sprintf('%s %s %s',
			self::$protocolVersionMap[$this->protocolVersion],
			$this->statusCode,
			self::$statusCodeMap[$this->statusCode]
		));

		return $this;
	}
480058
public function setAccessControlAllowHeaders($headers)
    {
        if (is_array($headers)) {
            $headers = implode(', ', $headers);
        }

        $this->setHeader('Access-Control-Allow-Headers', (string) $headers);

        return $this;
    }
978137
private function parseHeaders(array $headers)
    {
        $indexes = [];
        $metas   = [];

        foreach ($headers as $key => $value) {
            $key = strtolower($key);

            if (strpos($key, 'x-riak-index-') === 0) {
                $name  = substr($key, 13);
                $value = isset($indexes[$name])
                    ? array_merge($indexes[$name], $value)
                    : $value;

                $indexes[$name] = $value;
            }

            if (strpos($key, 'x-riak-meta-') === 0) {
                $name  = strtolower(substr($key, 12));
                $value = is_array($value)
                    ? reset($value)
                    : $value;

                $metas[$name] = $value;
            }
        }

        return [
            'indexes' => $indexes,
            'metas'   => $metas
        ];
    }
70985
public function parseHeaders(array $headers)
    {
        foreach ($headers as $key => $value) {
            if (strpos($key, 'HTTP_') !== false) {
                $newKey                 = str_replace(['http_', '_'], ['', '-'],
                    mb_strtolower($key));
                $this->headers[$newKey] = $value;
            }
        }
        return $this->headers;
    }
1177066
private function setHeaders($headers) {
        // Make array of the different headers
        $headers = explode(PHP_EOL, $headers);

        foreach ($headers as $header) {
            // Cut the header into pieces
            $header = explode(': ', $header);

            // Skip header if it's not in the default format
            if (!is_array($header) && count($header) === 1) {
                continue;
            }

            // Get the header type
            $type = strtolower(array_shift($header));

            // Glue the header back together
            $value = implode(': ', $header);

            // Skip header if the type or value is empty
            if (empty($type) || empty($value)) {
                continue;
            }

            // Store the header
            $this->headers[$type] = trim($value);
        }
    }
1261704
protected function withHeaders(array $headers)
    {
        $clean = [];

        foreach ($headers as $key => $value) {
            if (! Str::startsWith($key, ['HTTP_', 'CONTENT_'])) {
                $key = 'HTTP_' . $key;
            }

            $clean[$key] = $value;
        }

        $this->headers = array_merge($this->headers, $clean);

        return $this;
    }
1231320
public function create(array $keyEncryptionAlgorithms, array $contentEncryptionAlgorithms, array $compressionMethods): JWEDecrypter
    {
        $keyEncryptionAlgorithmManager = $this->algorithmManagerFactory->create($keyEncryptionAlgorithms);
        $contentEncryptionAlgorithmManager = $this->algorithmManagerFactory->create($contentEncryptionAlgorithms);
        $compressionMethodManager = $this->compressionMethodManagerFactory->create($compressionMethods);

        return new JWEDecrypter($keyEncryptionAlgorithmManager, $contentEncryptionAlgorithmManager, $compressionMethodManager);
    }
700222
public function withHeaders($headers)
    {
        if ($headers instanceof HeaderBag) {
            $headers = $headers->all();
        }

        foreach ($headers as $key => $value) {
            $this->headers->set($key, $value);
        }

        return $this;
    }
1216085
public function header($headers) {
        // Record HTTP header
        if (is_array($headers)) {
            foreach ($headers as $header) {
                array_push($this->_headers, $header);
            }
        } else if (is_string($headers)) {
            array_push($this->_headers, $headers);
        }
        
        return $this;
    }
4121
protected function parseNestedKeyPairHeader($nestedPairs)
    {
        return array_reduce(explode(';', $nestedPairs), function($result, $pair) {
            $keyVal = explode('=', $pair, 2);
            $key = trim(array_shift($keyVal));
            $val = trim(implode('=', $keyVal));
            if ($key !== '' && $val !== '') {
                $result[$key] = $val;
            }
            return $result;
        }, []);
    }
361494
protected function normalizeHeaders(array $headers)
    {
        if (empty($headers["User-Agent"]))
            $headers["User-Agent"] = "evias NEM Blockchain Wrapper";

        if (empty($headers["Accept"]))
            $headers["Accept"] = "application/json";

        if (empty($headers["Content-Type"]))
            $headers["Content-Type"] = "application/json";

        return $headers;
    }
505895
protected function getSimpleHeaders()
    {
        $out = [];
        foreach ($this->headers as $key => $values) {
            $header = $this->headerNames[strtolower($key)];
            if (count($values) === 1) {
                $values = $values[0];
            }
            $out[$header] = $values;
        }

        return $out;
    }
820300
public function setMultiple(array $headers): HeaderCollection
    {
        foreach ($headers as $key => $value) {
            $key = $this->getKey($key, true);
            $this->headers[$key] = $value;
        }
        return $this;
    }
110987
public function appendHeaders(array $headers = [])
    {
        // Append headers.
        $this->headers = collect($this->headers)->merge($headers)->all();

        // Return calling object.
        return $this;
    }
964756
public function addHeaders(array $headers = [])
    {
        $this->headers = [];
        if($headers != []) {
            foreach ($headers as $header) {
                $this->headers[] = $header;
            }
        }
        return $this;
    }