summaryrefslogtreecommitdiffstats
path: root/lib/private/Security/CSP
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
commitcaff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch)
tree186d494c2aea5dea7255d3584ef5d595fc6e6194 /lib/private/Security/CSP
parentedf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff)
downloadnextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.tar.gz
nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.zip
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds unified formatting for control structures like if and loops as well as classes, their methods and anonymous functions. This basically forces the constructs to start on the same line. This is not exactly what PSR2 wants, but I think we can have a few exceptions with "our" style. The starting of braces on the same line is pracrically standard for our code. This also removes and empty lines from method/function bodies at the beginning and end. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/Security/CSP')
-rw-r--r--lib/private/Security/CSP/ContentSecurityPolicy.php1
-rw-r--r--lib/private/Security/CSP/ContentSecurityPolicyManager.php6
-rw-r--r--lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php4
3 files changed, 5 insertions, 6 deletions
diff --git a/lib/private/Security/CSP/ContentSecurityPolicy.php b/lib/private/Security/CSP/ContentSecurityPolicy.php
index 4db1314e782..4d41bd56206 100644
--- a/lib/private/Security/CSP/ContentSecurityPolicy.php
+++ b/lib/private/Security/CSP/ContentSecurityPolicy.php
@@ -245,5 +245,4 @@ class ContentSecurityPolicy extends \OCP\AppFramework\Http\ContentSecurityPolicy
public function setReportTo(array $reportTo) {
$this->reportTo = $reportTo;
}
-
}
diff --git a/lib/private/Security/CSP/ContentSecurityPolicyManager.php b/lib/private/Security/CSP/ContentSecurityPolicyManager.php
index 9f1a480ccce..4245fdcb2de 100644
--- a/lib/private/Security/CSP/ContentSecurityPolicyManager.php
+++ b/lib/private/Security/CSP/ContentSecurityPolicyManager.php
@@ -59,7 +59,7 @@ class ContentSecurityPolicyManager implements IContentSecurityPolicyManager {
$this->dispatcher->dispatch(AddContentSecurityPolicyEvent::class, $event);
$defaultPolicy = new \OC\Security\CSP\ContentSecurityPolicy();
- foreach($this->policies as $policy) {
+ foreach ($this->policies as $policy) {
$defaultPolicy = $this->mergePolicies($defaultPolicy, $policy);
}
return $defaultPolicy;
@@ -74,9 +74,9 @@ class ContentSecurityPolicyManager implements IContentSecurityPolicyManager {
*/
public function mergePolicies(ContentSecurityPolicy $defaultPolicy,
EmptyContentSecurityPolicy $originalPolicy): ContentSecurityPolicy {
- foreach((object)(array)$originalPolicy as $name => $value) {
+ foreach ((object)(array)$originalPolicy as $name => $value) {
$setter = 'set'.ucfirst($name);
- if(\is_array($value)) {
+ if (\is_array($value)) {
$getter = 'get'.ucfirst($name);
$currentValues = \is_array($defaultPolicy->$getter()) ? $defaultPolicy->$getter() : [];
$defaultPolicy->$setter(array_values(array_unique(array_merge($currentValues, $value))));
diff --git a/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php b/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php
index 9dec2907b2f..06f8faece13 100644
--- a/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php
+++ b/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php
@@ -61,7 +61,7 @@ class ContentSecurityPolicyNonceManager {
* @return string
*/
public function getNonce(): string {
- if($this->nonce === '') {
+ if ($this->nonce === '') {
if (empty($this->request->server['CSP_NONCE'])) {
$this->nonce = base64_encode($this->csrfTokenManager->getToken()->getEncryptedValue());
} else {
@@ -86,7 +86,7 @@ class ContentSecurityPolicyNonceManager {
'/^Mozilla\/5\.0 \([^)]+\) AppleWebKit\/[0-9.]+ \(KHTML, like Gecko\) Version\/(?:1[2-9]|[2-9][0-9])\.[0-9]+(?:\.[0-9]+)? Safari\/[0-9.A-Z]+$/',
];
- if($this->request->isUserAgent($browserWhitelist)) {
+ if ($this->request->isUserAgent($browserWhitelist)) {
return true;
}