Output headers

@param array $headers
334671
public function output_headers($headers) {
        $this->columns = $headers;
        if (method_exists($this->dataformat, 'write_header')) {
            error_log('The function write_header() does not support multiple sheets. In order to support multiple sheets you ' .
                'must implement start_output() and start_sheet() and remove write_header() in your dataformat.');
            $this->dataformat->write_header($headers);
        } else {
            $this->dataformat->start_sheet($headers);
        }
    }
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;
    }
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;
    }
148208
public function setHeaders($headers)
    {
        $this->headers = $headers;
        $signature = new Signature(array('headers' => $headers));
        $this->setSignature($signature);
    }
1274629
public function setHeaders($headers)
    {
        $headerCollection = $this->getHeaderCollection();
        $headerCollection->removeAll();
        $headerCollection->fromArray($headers);
    }
241533
public function setHeader($headers = [])
    {
        $this->headers = $headers;
        $this->debug->info(__FUNCTION__, 'setHeaders: ', $this->headers);

        return $this;
    }
808119
private function getHeaders(array $headers)
    {
        $str = '';
        foreach ($headers as $key => $value) {
            $str .= "{$key}: {$value}\r\n";
        }

        return "--{$this->boundary}\r\n" . trim($str) . "\r\n\r\n";
    }
643142
public function addHeaders(array $headers)
    {
        foreach ($headers as $name => $content) {
            $this->headers[$name] = $content;
        }
    }
401156
public function setHeaders($headers)
    {
        $this->requireOpenConnection();

        $response = $this->curl(
            'POST',
            '/proxy/' . $this->port . '/headers',
            (object)$headers
        );
    }
771688
public function setHeaders(array $headers, $append = false)
    {
        if (!$append) {
            $this->headers = $headers;
        } else {
            foreach ($headers as $field => $value) {
                $this->setHeader($field, $value);
            }
        }
    }
54001
protected function encodeHeaders(array $headers): string
    {
        $data = '';

        foreach ($headers as $name => $values) {
            foreach ($values as $value) {
                $data .= sprintf("%s: %s\r\n", $name, $this->encodeHeader($value));
            }
        }

        return $data;
    }
698648
private function assertHeaders(array $headers)
    {
        foreach ($headers as $name => $headerValues) {
            HeaderSecurity::assertValidName($name);
            array_walk($headerValues, __NAMESPACE__ . '\HeaderSecurity::assertValid');
        }
    }
1291631
protected function setHeaders(array $headers)
    {
        foreach ($headers as $header) {

            if (isset($header['name']) && isset($header['value'])) {
                $this->headers[$header['name']] = $header['value'];
            }
        }

        return $this;
    }
163891
private function saveHeaders ($header, &$headers)
    {
        if ($headers === NULL)
        {
            return;
        }

        $header       = explode("\r\n", $header);
        $headers      = array();
        $headerLength = count($header);

        // The 1st element is the HTTP code, so we can safely skip it
        for ($i = 1; $i < $headerLength; $i++)
        {
            list($key, $val) = explode(":", $header[$i]);
            $headers[$key] = trim($val);
        }
    }
1334356
public function setHeaders(array $headers = []): Headers
    {
        $this->headers = array();

        foreach ($headers as $header => $data) {
            $this->setHeader((string)$header, (string)$data);
        }

        return $this;
    }
1121070
public function writeFooter(array $headers)
    {
        $bar = $this->table_connectorLeft;

        foreach ($headers as $name => $length) {
            $bar .= str_pad('', $length + 2, $this->table_barFiller).''.$this->table_connectorRight;
        }

        $this->output->writeln($bar);
    }
1332550
protected function outputHeaders()
    {
        $headersSent = headers_sent($file, $line);
        if (!$headersSent) {
            $method = sprintf(
                "%s %d %s",
                $_SERVER['SERVER_PROTOCOL'],
                $this->getStatusCode(),
                $this->getStatusDescription()
            );
            header($method);
            foreach ($this->getHeaders() as $header => $value) {
                header("{$header}: {$value}", true, $this->getStatusCode());
            }
        } elseif ($this->getStatusCode() >= 300) {
            // It's critical that these status codes are sent; we need to report a failure if not.
            user_error(
                sprintf(
                    "Couldn't set response type to %d because of output on line %s of %s",
                    $this->getStatusCode(),
                    $line,
                    $file
                ),
                E_USER_WARNING
            );
        }
    }