$header = '';
foreach ($this->tempHeaders
as $name =>
$value) { $header .= " {
$name} {
$value};";
} // add token only if needed
if ($this->upgradeInsecureRequests
) { $header .= ' upgrade-insecure-requests;';
} $response->
appendHeader('Content-Security-Policy',
$header);
} if (!
empty($this->reportOnlyHeaders
)) { $header = '';
foreach ($this->reportOnlyHeaders
as $name =>
$value) { $header .= " {
$name} {
$value};";
} $response->
appendHeader('Content-Security-Policy-Report-Only',
$header);
}