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:
Fabien Potencier 2020-07-23 08:36:58 +02:00
commit 564550bbf8
1 changed files with 8 additions and 1 deletions

View File

@ -127,8 +127,15 @@ class ContentSecurityPolicyHandler
$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 (['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)) {
continue;
}