minor #37587 [WebProfileBundle] Readability update (shreypuranik)
This PR was submitted for the master branch but it was merged into the 3.4 branch instead.
Discussion
----------
[WebProfileBundle] Readability update
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| License | MIT
Updating ContentSecurityPolicyHandler by moving array out of foreach loop for ease of readability.
Commits
-------
6a7685f315
Readability update
This commit is contained in:
commit
564550bbf8
|
@ -127,8 +127,15 @@ class ContentSecurityPolicyHandler
|
||||||
|
|
||||||
$headers = $this->getCspHeaders($response);
|
$headers = $this->getCspHeaders($response);
|
||||||
|
|
||||||
|
$types = [
|
||||||
|
'script-src' => 'csp_script_nonce',
|
||||||
|
'script-src-elem' => 'csp_script_nonce',
|
||||||
|
'style-src' => 'csp_style_nonce',
|
||||||
|
'style-src-elem' => 'csp_style_nonce'
|
||||||
|
];
|
||||||
|
|
||||||
foreach ($headers as $header => $directives) {
|
foreach ($headers as $header => $directives) {
|
||||||
foreach (['script-src' => 'csp_script_nonce', 'script-src-elem' => 'csp_script_nonce', 'style-src' => 'csp_style_nonce', 'style-src-elem' => 'csp_style_nonce'] as $type => $tokenName) {
|
foreach ($types as $type => $tokenName) {
|
||||||
if ($this->authorizesInline($directives, $type)) {
|
if ($this->authorizesInline($directives, $type)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue