Transform the given set of headers

@param HeaderBag $HeaderBag
@return void
166361
public function modify(HeaderBag &$HeaderBag)
    {
        $CSPHeaders = array_merge(
            $this->mode & self::ENFORCE ?
                $HeaderBag->getByName('content-security-policy') : [],
            $this->mode & self::REPORT ?
                $HeaderBag->getByName('content-security-policy-report-only') : []
        );

        foreach ($CSPHeaders as $Header)
        {
            $directive = $this->canInjectStrictDynamic($Header);

            if (is_string($directive))
            {
                $Header->setAttribute($directive, "'strict-dynamic'");
            }
            elseif ($directive !== -1)
            {
                $this->addError(
                    "<b>Strict-Mode</b> is enabled, but
                    <b>'strict-dynamic'</b> could not be added to <b>"
                    . $Header->getFriendlyName()
                    . '</b> because no hash or nonce was used.',
                    E_USER_WARNING
                );
            }
        }
    }
146285
public function remove($key) {
        $key = $this->formatKey($key);
        array_remove($this->headers, $key);
    }
386992
public function setBags(array $bags)
    {
        foreach ($bags as $name => $bag) {
            $this->setBag($name, $bag);
        }

        return $this;
    }
94559
public function setEmailsDomains(BagHelper $emailBag)
    {
        $domainBag = new BagHelper();
        foreach ($emailBag as $key => $emails) {
            foreach ($emails as $email) {
                $mail = new Email($email);
                list($user, $domain) = $mail->parse();
                $domainBag->set($domain, $user, false);
            }
        }
        return $domainBag;
    }
846820
public function setHeaders(TableNode $headers)
    {
        foreach ($headers->getRowsHash() as $name => $value) {
            $this->setHeader($name, $value);
        }
    }
1220303
public function modify(HeaderBag &$headers)
    {
        $cspHeaders = [
            'Content-Security-Policy' => 'csp',
            'Content-Security-Policy-Report-Only' => 'cspro',
        ];

        foreach ($cspHeaders as $header => $type)
        {
            if ($this->combine)
            {
                $otherPolicyHeaders = $headers->getByName($header);

                $policies = [$this->{$type.'Config'}];

                foreach ($otherPolicyHeaders as $otherPolicy)
                {
                    $policies[]
                        = self::deconstructCSP($otherPolicy->getValue());
                }

                $this->{$type.'Config'} = self::mergeCSPList($policies);
            }

            $value = $this->{'compile'.strtoupper($type)}();

            if (empty($value))
            {
                continue;
            }

            $headers->{($this->combine ? 'replace' : 'add')}($header, $value);

            if ($this->sendLegacyHeaders)
            {
                $headers->{($this->combine ? 'replace' : 'add')}("X-$header", $value);
            }
        }
    }
1333821
private function rebuildHeader(array $headers)
    {
        $header = [];

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

        return $header;
    }
740098
public function modify(HeaderBag &$headers)
    {
        $cookies = $headers->getByName('set-cookie');

        $headers->remove('set-cookie');

        foreach ($cookies as $key => $cookie)
        {
            $cookieName = $cookie->getFirstAttributeName();

            if ( ! in_array(strtolower($cookieName), $this->removedCookies))
            {
                $headers->add('Set-Cookie', $cookie->getValue());
            }
        }
    }
1203745
protected function withErrorBag($errorBag, callable $callback)
    {
        $this->validatesRequestErrorBag = $errorBag;

        call_user_func($callback);

        $this->validatesRequestErrorBag = null;
    }
114053
protected static function fixAuthHeader(\Symfony\Component\HttpFoundation\HeaderBag $headers)
    {
        if (!$headers->has('Authorization') && function_exists('apache_request_headers')) {
            $all = apache_request_headers();
            if (isset($all['Authorization'])) {
                $headers->set('Authorization', $all['Authorization']);
            }
        }
    }
617568
protected function getCacheLifetime(ResponseHeaderBag $headers)
    {
        $maxAge = 0;
        if ($headers->hasCacheControlDirective('max-age')) {
            $maxAge = $headers->getCacheControlDirective('max-age');
        }

        return $maxAge;
    }
1228681
protected function processParamBag(ParameterBag $bag)
    {
        $parameters = $bag->all();

        if (! empty($parameters) && count($parameters) > 0) {
            $parameters = snake_case_array_keys($parameters);

            $bag->replace($parameters);
        }
    }
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;
    }
1190303
protected function setHeaders(Array $headers = []) {
    foreach ($headers as $property => $value) {
      $this->client->setHeader($property, $value);
    }
  }
1057725
public function addGlobalHeaders($headers)
    {
        if (current($headers) instanceof Header) {
            foreach ($headers as $header) {
                $this->addGlobalHeader($header);
            }
        } else {
            foreach ($headers as $key => $value) {
                $this->addGlobalHeader($key, $value);
            }
        }
    }
241533
public function setHeader($headers = [])
    {
        $this->headers = $headers;
        $this->debug->info(__FUNCTION__, 'setHeaders: ', $this->headers);

        return $this;
    }
700222
public function withHeaders($headers)
    {
        if ($headers instanceof HeaderBag) {
            $headers = $headers->all();
        }

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

        return $this;
    }