Completed
Push — master ( 869df2...92b5b5 )
by Morris
33:59 queued 18:48
created
lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php 2 patches
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -34,54 +34,54 @@
 block discarded – undo
34 34
  * @package OC\Security\CSP
35 35
  */
36 36
 class ContentSecurityPolicyNonceManager {
37
-	/** @var CsrfTokenManager */
38
-	private $csrfTokenManager;
39
-	/** @var IRequest */
40
-	private $request;
41
-	/** @var string */
42
-	private $nonce = '';
37
+    /** @var CsrfTokenManager */
38
+    private $csrfTokenManager;
39
+    /** @var IRequest */
40
+    private $request;
41
+    /** @var string */
42
+    private $nonce = '';
43 43
 
44
-	/**
45
-	 * @param CsrfTokenManager $csrfTokenManager
46
-	 * @param IRequest $request
47
-	 */
48
-	public function __construct(CsrfTokenManager $csrfTokenManager,
49
-								IRequest $request) {
50
-		$this->csrfTokenManager = $csrfTokenManager;
51
-		$this->request = $request;
52
-	}
44
+    /**
45
+     * @param CsrfTokenManager $csrfTokenManager
46
+     * @param IRequest $request
47
+     */
48
+    public function __construct(CsrfTokenManager $csrfTokenManager,
49
+                                IRequest $request) {
50
+        $this->csrfTokenManager = $csrfTokenManager;
51
+        $this->request = $request;
52
+    }
53 53
 
54
-	/**
55
-	 * Returns the current CSP nounce
56
-	 *
57
-	 * @return string
58
-	 */
59
-	public function getNonce(): string {
60
-		if($this->nonce === '') {
61
-			$this->nonce = base64_encode($this->csrfTokenManager->getToken()->getEncryptedValue());
62
-		}
54
+    /**
55
+     * Returns the current CSP nounce
56
+     *
57
+     * @return string
58
+     */
59
+    public function getNonce(): string {
60
+        if($this->nonce === '') {
61
+            $this->nonce = base64_encode($this->csrfTokenManager->getToken()->getEncryptedValue());
62
+        }
63 63
 
64
-		return $this->nonce;
65
-	}
64
+        return $this->nonce;
65
+    }
66 66
 
67
-	/**
68
-	 * Check if the browser supports CSP v3
69
-	 *
70
-	 * @return bool
71
-	 */
72
-	public function browserSupportsCspV3(): bool {
73
-		$browserWhitelist = [
74
-			Request::USER_AGENT_CHROME,
75
-			// Firefox 45+
76
-			'/^Mozilla\/5\.0 \([^)]+\) Gecko\/[0-9.]+ Firefox\/(4[5-9]|[5-9][0-9])\.[0-9.]+$/',
77
-			// Safari 12+
78
-			'/^Mozilla\/5\.0 \([^)]+\) AppleWebKit\/[0-9.]+ \(KHTML, like Gecko\) Version\/(1[2-9]|[2-9][0-9])\.[0-9]+ Safari\/[0-9.A-Z]+$/',
79
-		];
67
+    /**
68
+     * Check if the browser supports CSP v3
69
+     *
70
+     * @return bool
71
+     */
72
+    public function browserSupportsCspV3(): bool {
73
+        $browserWhitelist = [
74
+            Request::USER_AGENT_CHROME,
75
+            // Firefox 45+
76
+            '/^Mozilla\/5\.0 \([^)]+\) Gecko\/[0-9.]+ Firefox\/(4[5-9]|[5-9][0-9])\.[0-9.]+$/',
77
+            // Safari 12+
78
+            '/^Mozilla\/5\.0 \([^)]+\) AppleWebKit\/[0-9.]+ \(KHTML, like Gecko\) Version\/(1[2-9]|[2-9][0-9])\.[0-9]+ Safari\/[0-9.A-Z]+$/',
79
+        ];
80 80
 
81
-		if($this->request->isUserAgent($browserWhitelist)) {
82
-			return true;
83
-		}
81
+        if($this->request->isUserAgent($browserWhitelist)) {
82
+            return true;
83
+        }
84 84
 
85
-		return false;
86
-	}
85
+        return false;
86
+    }
87 87
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 * @return string
58 58
 	 */
59 59
 	public function getNonce(): string {
60
-		if($this->nonce === '') {
60
+		if ($this->nonce === '') {
61 61
 			$this->nonce = base64_encode($this->csrfTokenManager->getToken()->getEncryptedValue());
62 62
 		}
63 63
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 			'/^Mozilla\/5\.0 \([^)]+\) AppleWebKit\/[0-9.]+ \(KHTML, like Gecko\) Version\/(1[2-9]|[2-9][0-9])\.[0-9]+ Safari\/[0-9.A-Z]+$/',
79 79
 		];
80 80
 
81
-		if($this->request->isUserAgent($browserWhitelist)) {
81
+		if ($this->request->isUserAgent($browserWhitelist)) {
82 82
 			return true;
83 83
 		}
84 84
 
Please login to merge, or discard this patch.