@param array $complete_headers

@return \Jose\Algorithm\KeyEncryptionAlgorithmInterface
353019
private function findKeyEncryptionAlgorithm(array $complete_headers)
    {
        Assertion::keyExists($complete_headers, 'alg', 'Parameter "alg" is missing.');

        $key_encryption_algorithm = $this->getJWAManager()->getAlgorithm($complete_headers['alg']);
        Assertion::isInstanceOf($key_encryption_algorithm, KeyEncryptionAlgorithmInterface::class, sprintf('The key encryption algorithm "%s" is not supported or not a key encryption algorithm instance.', $complete_headers['alg']));

        return $key_encryption_algorithm;
    }
297907
protected function setHeaders(array $headers)
    {
        $this->headers = [];
        
        foreach ($headers as $name => $values) {
            $this->assertHeaderName($name);
            $this->assertHeaderValue($values);
        
            $key = strtolower($name);
            $this->headers[$key] = ['name' => $name, 'values' => (array)$values];
        }
    }
216285
public function setHeaders(array $headers, $replace = false)
    {
        if ($replace) {
            $this->headers = $headers;
        } else {
            foreach ($headers as $key => $value) {
                $this->headers[$key] = $value;
            }
        }

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

        return new JWEBuilder($this->jsonConverter, $keyEncryptionAlgorithmManager, $contentEncryptionAlgorithmManager, $compressionMethodManager);
    }
964756
public function addHeaders(array $headers = [])
    {
        $this->headers = [];
        if($headers != []) {
            foreach ($headers as $header) {
                $this->headers[] = $header;
            }
        }
        return $this;
    }
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;
    }
616784
public function setHeader(array $header)
    {
        if (is_numeric(key($header))) {
            $header = array_fill_keys($header, '');
        }
        $this->header = $header;

        return $this;
    }
1326795
public static function http_parse_headers($raw_headers)
    {
        $headers = [];
        $key     = ''; // [+]

        foreach (explode("\n", $raw_headers) as $i => $h) {
            $h = explode(':', $h, 2);

            if (isset($h[1])) {
                if (!isset($headers[$h[0]])) {
                    $headers[$h[0]] = trim($h[1]);
                } elseif (is_array($headers[$h[0]])) {
                    // $tmp = array_merge($headers[$h[0]], array(trim($h[1]))); // [-]
                    // $headers[$h[0]] = $tmp; // [-]
                    $headers[$h[0]] = array_merge($headers[$h[0]], [trim($h[1])]); // [+]
                } else {
                    // $tmp = array_merge(array($headers[$h[0]]), array(trim($h[1]))); // [-]
                    // $headers[$h[0]] = $tmp; // [-]
                    $headers[$h[0]] = array_merge([$headers[$h[0]]], [trim($h[1])]); // [+]
                }

                $key = $h[0]; // [+]
            } else {
                // [+]
                // [+]
                if (substr($h[0], 0, 1) == "\t") {
                    // [+]
                    $headers[$key] .= "\r\n\t" . trim($h[0]);
                } // [+]
                elseif (!$key) {
                    // [+]
                    $headers[0] = trim($h[0]);
                }
                trim($h[0]); // [+]
            } // [+]
        }

        return $headers;
    }
267261
public function addHeaders(array $headers)
    {
        $headerCollection = $this->getHeaders();
        foreach ($headers as $name => $value) {
            $headerCollection->add($name, $value);
        }
        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;
        }, []);
    }
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;
    }
1176656
public function addHeaders(array $headers)
    {
        foreach ($headers as $name => $value) {
            if (is_numeric($name)) {
                $this->parseHeaderLine($value);
            } else {
                $this->addHeader($name, $value);
            }
        }
        return $this;
    }
615000
protected function prepareHeaders(array $headers = array())
    {
        $preparedHeaders = '';

        foreach($headers as $field => $content)
        {
            $fieldComponents = explode('-', $field);
            array_walk($fieldComponents, function(&$fieldComponent) {
                $fieldComponent = ucfirst(strtolower($fieldComponent));
            });
            $field = implode('-', $fieldComponents);

            $preparedHeaders .= sprintf("%s: %s \r\n", $field, $content);
        }

        return $preparedHeaders;
    }
10015
public function setHeaders(array $headers = [])
    {

        $this->headers = ($headers instanceof Headers) ? $headers : new Headers((array)$headers);

        return $this;

    }
149351
public function authHeaders(array $headers = [ ])
    {
        if (count($headers) == 0) {
            $headers = [ 'X-Application' => Auth::$appKey, 'X-Authentication' => Auth::$sessionToken ];
        }
        $this->options[ 'headers' ] = array_merge($this->options[ 'headers' ], $headers);
        return $this;
    }
547033
private function getSignatureAlgorithm(array $complete_header, Object\JWKInterface $key)
    {
        Assertion::keyExists($complete_header, 'alg', 'No "alg" parameter set in the header.');

        Assertion::false(
            $key->has('alg') && $key->get('alg') !== $complete_header['alg'],
            sprintf('The algorithm "%s" is not allowed with this key.', $complete_header['alg'])
        );

        $signature_algorithm = $this->getJWAManager()->getAlgorithm($complete_header['alg']);
        Assertion::isInstanceOf($signature_algorithm, Algorithm\SignatureAlgorithmInterface::class, sprintf('The algorithm "%s" is not supported.', $complete_header['alg']));

        return $signature_algorithm;
    }
980499
public function addHeaders(array $headers)
    {

        foreach ($headers as $key => $value) {
            $header = NULL;
            //Handle Array of String based Headers
            if (is_numeric($key) && strpos($value,":") !== FALSE) {
                $arr = explode(":",$value,2);
                if (count($arr)==2){
                    $header = $arr[0];
                    $value = trim($arr[1]);
                }
            } else {
                $header = $key;
            }
            if ($header !== NULL){
                $this->addHeader($header, $value);
            }
        }
        return $this;
    }