Generates a table header

@param array $aElements
@param boolean $bHeadersBreaked
@return string
189012
private function setTableHeader($aElements, $bHeadersBreaked)
    {
        $aTableHeader = $aElements;
        if ($bHeadersBreaked) {
            $aTableHeader = $this->setArrayToArrayKbr($aElements);
        }
        $sReturn = [];
        foreach (array_keys($aTableHeader) as $value) {
            $sReturn[] = $this->setStringIntoTag($value, 'th');
        }
        return implode('', $sReturn);
    }
969576
private function generateTableHeader($pSheet)
    {
        $sheetIndex = $pSheet->getParent()->getIndex($pSheet);

        // Construct HTML
        $html = '';
        $html .= $this->setMargins($pSheet);
            
        if (!$this->useInlineCss) {
            $gridlines = $pSheet->getShowGridlines() ? ' gridlines' : '';
            $html .= '    <table border="0" cellpadding="0" cellspacing="0" id="sheet' . $sheetIndex . '" class="sheet' . $sheetIndex . $gridlines . '">' . PHP_EOL;
        } else {
            $style = isset($this->cssStyles['table']) ?
                $this->assembleCSS($this->cssStyles['table']) : '';

            if ($this->isPdf && $pSheet->getShowGridlines()) {
                $html .= '    <table border="1" cellpadding="1" id="sheet' . $sheetIndex . '" cellspacing="1" style="' . $style . '">' . PHP_EOL;
            } else {
                $html .= '    <table border="0" cellpadding="1" id="sheet' . $sheetIndex . '" cellspacing="0" style="' . $style . '">' . PHP_EOL;
            }
        }

        // Write <col> elements
        $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($pSheet->getHighestColumn()) - 1;
        $i = -1;
        while ($i++ < $highestColumnIndex) {
            if (!$this->isPdf) {
                if (!$this->useInlineCss) {
                    $html .= '        <col class="col' . $i . '">' . PHP_EOL;
                } else {
                    $style = isset($this->cssStyles['table.sheet' . $sheetIndex . ' col.col' . $i]) ?
                        $this->assembleCSS($this->cssStyles['table.sheet' . $sheetIndex . ' col.col' . $i]) : '';
                    $html .= '        <col style="' . $style . '">' . PHP_EOL;
                }
            }
        }

        return $html;
    }
1092982
public function determineHeaderStringForSignedRequest(array $headers): string
    {
        $signedDataHeaderString = self::SIGNED_DATA_EMPTY_STRING;
        ksort($headers);

        foreach ($headers as $headerName => $headerValue) {
            // Not all headers should be signed.
            // The User-Agent and Cache-Control headers need to be signed.
            if ($headerName === self::HEADER_USER_AGENT || $headerName === self::HEADER_CACHE_CONTROL) {
                $signedDataHeaderString .= self::NEWLINE;
                $signedDataHeaderString .= $this->determineHeaderStringLine($headerName, $headerValue);
            }

            // All headers with the prefix 'X-Bunq-' except 'Server-Signature' need to be signed.
            if ($headerName === self::HEADER_SERVER_SIGNATURE) {
                // Skip this header
            } elseif (strpos($headerName, self::HEADER_PREFIX) === self::HEADER_PREFIX_START) {
                $signedDataHeaderString .= self::NEWLINE;
                $signedDataHeaderString .= $this->determineHeaderStringLine($headerName, $headerValue);
            }
        }

        return $signedDataHeaderString;
    }
404427
public function getHtmlHeader(): string
  {
    $ret = Html::generateTag('tr', ['class' => [OverviewTable::$class, 'header']]);
    foreach ($this->slatJoints as $factory)
    {
      $ret .= $factory->getHtmlColumnHeader();
    }
    $ret .= '<th class="error"></th>';
    $ret .= '</tr>';

    if ($this->filter)
    {
      $ret .= Html::generateTag('tr', ['class' => [OverviewTable::$class, 'filter']]);
      foreach ($this->slatJoints as $factory)
      {
        $ret .= $factory->getHtmlColumnFilter();
      }
      $ret .= '<th class="error"></th>';
      $ret .= '</tr>';
    }

    return $ret;
  }
384484
protected static function buildAdditionalHeadersString(&$headers)
    {
        $headersAddStr = '';
        $eol = "\r\n";
        foreach ($headers as $k => $v) {
            if (in_array($k, array('To','Subject','Body','Attachments'))) {
                continue;
            }
            if (empty($v)) {
                continue;
            }
            if ($k == 'From' && isset($_SERVER['WINDIR'])) {
                $fromAddress = preg_match('/<(.*?)>/', $v, $matches)
                    ? $matches[1]
                    : $v;
                // $this->debug->log('setting sendmail_from to '.$fromAddress);
                ini_set('sendmail_from', $fromAddress);
            }
            $headersAddStr .= $k.': '.$v.$eol;
        }
        $headersAddStr = substr($headersAddStr, 0, -strlen($eol));  // remove final $eol;
        return $headersAddStr;
    }
1137956
private function generateCspHeader(array $directives)
    {
        return array_reduce(array_keys($directives), function ($res, $name) use ($directives) {
            return ('' !== $res ? $res.'; ' : '').sprintf('%s %s', $name, implode(' ', $directives[$name]));
        }, '');
    }
1047284
private function getHeaders(array $headers)
    {
        $str = '';
        foreach ($headers as $key => $value) {
            $str .= sprintf("%s: %s\r\n", $key, $value);
        }

        return $str;
    }
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";
    }
1109569
protected function flattenHeaders(array $headers)
    {
        foreach ($headers as &$value) {
            $value = is_array($value) ? end($value) : $value;
        }
        
        return $headers;
    }
1279500
private function getPresignHeaders(array $headers)
    {
        $presignHeaders = [];
        $blacklist = $this->getHeaderBlacklist();
        foreach ($headers as $name => $value) {
            $lName = strtolower($name);
            if (!isset($blacklist[$lName])
                && $name !== self::AMZ_CONTENT_SHA256_HEADER
            ) {
                $presignHeaders[] = $lName;
            }
        }
        return $presignHeaders;
    }
175856
public static function formatHeadersForCurl(array $headers)
    {
        $curlHeaders = array();

        foreach ($headers as $key => $value) {
            $curlHeaders[] = $key . ': ' . $value;
        }

        return $curlHeaders;
    }
1012488
protected function generateTemplate(string $sType, array $aEmailBits): string
    {
        $sClassName = end($aEmailBits);
        if ($sType === 'HTML') {
            return $this->generateTemplateDir($aEmailBits) . strtolower($sClassName) . '.php';
        } else {
            return $this->generateTemplateDir($aEmailBits) . strtolower($sClassName) . '_plaintext.php';
        }
    }
383877
protected function findHost(array $headers): string
    {
        foreach ($headers as $name => $values) {
            if (strtolower($name) === 'host') {
                return $values[0];
            }
        }

        throw new MessageException(Response::BAD_REQUEST, 'No host header in message.');
    }
584273
public function addHeader($items)
    {
        if (! is_array($items)) {
            $items = func_get_args();
        }

        $this->addElement(new Header($items));

        return $this;
    }
1203728
protected function setArrayToStringForUrl($sSeparator, $aElements, $aExceptedElements = [''])
    {
        $outArray = $this->normalizeArrayForUrl($aElements);
        if (count($outArray) < 1) {
            return '';
        }
        $xptArray   = $this->normalizeArrayForUrl($aExceptedElements);
        $finalArray = array_diff_key($outArray, $xptArray);
        return http_build_query($finalArray, '', $sSeparator);
    }
1206721
private function getRawHeaders(array $headers)
    {
        $rawHeaders = '';
        foreach ($headers as $key => $value) {
            $rawHeaders .= sprintf("%s: %s\n", $key, is_array($value) ? implode(', ', $value) : $value);
        }
        $rawHeaders .= "\n";

        return $rawHeaders;
    }
701376
protected function table(array $headers, array $data)
    {
        $dataset = [];

        foreach (array_values($data) as $value) {
            $dataset[] = array_combine($headers, $value);
        }

        return Utils\format_items('table', $dataset, $headers);
    }