Test Failed
Push — dependabot/composer/newinterna... ( de8420 )
by
unknown
13:57 queued 08:25
created
includes/Router/IRequestRouter.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@
 block discarded – undo
18 18
  */
19 19
 interface IRequestRouter
20 20
 {
21
-    /**
22
-     * @return IRoutedTask
23
-     * @throws Exception
24
-     */
25
-    public function route();
21
+	/**
22
+	 * @return IRoutedTask
23
+	 * @throws Exception
24
+	 */
25
+	public function route();
26 26
 }
27 27
\ No newline at end of file
Please login to merge, or discard this patch.
includes/Router/PublicRequestRouter.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -15,42 +15,42 @@
 block discarded – undo
15 15
 
16 16
 class PublicRequestRouter extends RequestRouter
17 17
 {
18
-    /**
19
-     * Gets the route map to be used by this request router.
20
-     *
21
-     * @return array
22
-     */
23
-    protected function getRouteMap()
24
-    {
25
-        return array(
26
-            // Page showing a message stating the request has been submitted to our internal queues
27
-            'requestSubmitted'          =>
28
-                array(
29
-                    'class'   => PageRequestSubmitted::class,
30
-                    'actions' => array(),
31
-                ),
32
-            // Page showing a message stating that email confirmation is required to continue
33
-            'emailConfirmationRequired' =>
34
-                array(
35
-                    'class'   => PageEmailConfirmationRequired::class,
36
-                    'actions' => array(),
37
-                ),
38
-            // Action page which handles email confirmation
39
-            'confirmEmail'              =>
40
-                array(
41
-                    'class'   => PageConfirmEmail::class,
42
-                    'actions' => array(),
43
-                ),
44
-        );
45
-    }
18
+	/**
19
+	 * Gets the route map to be used by this request router.
20
+	 *
21
+	 * @return array
22
+	 */
23
+	protected function getRouteMap()
24
+	{
25
+		return array(
26
+			// Page showing a message stating the request has been submitted to our internal queues
27
+			'requestSubmitted'          =>
28
+				array(
29
+					'class'   => PageRequestSubmitted::class,
30
+					'actions' => array(),
31
+				),
32
+			// Page showing a message stating that email confirmation is required to continue
33
+			'emailConfirmationRequired' =>
34
+				array(
35
+					'class'   => PageEmailConfirmationRequired::class,
36
+					'actions' => array(),
37
+				),
38
+			// Action page which handles email confirmation
39
+			'confirmEmail'              =>
40
+				array(
41
+					'class'   => PageConfirmEmail::class,
42
+					'actions' => array(),
43
+				),
44
+		);
45
+	}
46 46
 
47
-    /**
48
-     * Gets the default route if no explicit route is requested.
49
-     *
50
-     * @return callable
51
-     */
52
-    protected function getDefaultRoute()
53
-    {
54
-        return array(PageRequestAccount::class, 'main');
55
-    }
47
+	/**
48
+	 * Gets the default route if no explicit route is requested.
49
+	 *
50
+	 * @return callable
51
+	 */
52
+	protected function getDefaultRoute()
53
+	{
54
+		return array(PageRequestAccount::class, 'main');
55
+	}
56 56
 }
57 57
\ No newline at end of file
Please login to merge, or discard this patch.
redir.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -7,46 +7,46 @@
 block discarded – undo
7 7
  ******************************************************************************/
8 8
 
9 9
 $toolList = array(
10
-    'tparis-pcount'      => '//tools.wmflabs.org/supercount/index.php?user=%DATA%&project=en.wikipedia',
11
-    'guc'                => '//tools.wmflabs.org/guc/?by=date&user=%DATA%',
12
-    'oq-whois'           => 'https://whois.domaintools.com/%DATA%',
13
-    'tl-whois'           => 'https://tools.wmflabs.org/whois/gateway.py?lookup=true&ip=%DATA%',
14
-    'honeypot'           => 'https://www.projecthoneypot.org/ip_%DATA%',
15
-    'stopforumspam'      => 'https://www.stopforumspam.com/ipcheck/%DATA%',
16
-    'google'             => 'https://www.google.com/search?q=%DATA%',
17
-    'domain'             => 'http://%DATA%/',
18
-    'rangefinder'        => 'https://tools.wmflabs.org/rangeblockfinder/?ip=%DATA%',
10
+	'tparis-pcount'      => '//tools.wmflabs.org/supercount/index.php?user=%DATA%&project=en.wikipedia',
11
+	'guc'                => '//tools.wmflabs.org/guc/?by=date&user=%DATA%',
12
+	'oq-whois'           => 'https://whois.domaintools.com/%DATA%',
13
+	'tl-whois'           => 'https://tools.wmflabs.org/whois/gateway.py?lookup=true&ip=%DATA%',
14
+	'honeypot'           => 'https://www.projecthoneypot.org/ip_%DATA%',
15
+	'stopforumspam'      => 'https://www.stopforumspam.com/ipcheck/%DATA%',
16
+	'google'             => 'https://www.google.com/search?q=%DATA%',
17
+	'domain'             => 'http://%DATA%/',
18
+	'rangefinder'        => 'https://tools.wmflabs.org/rangeblockfinder/?ip=%DATA%',
19 19
 	'ipcheck'            => 'https://ipcheck.toolforge.org/index.php?ip=%DATA%',
20 20
 	'bgpview'            => 'https://bgpview.io/ip/%DATA%'
21 21
 );
22 22
 
23 23
 if (!isset($_GET['tool'])
24
-    || !isset($toolList[$_GET['tool']])
25
-    || !isset($_GET['data'])
24
+	|| !isset($toolList[$_GET['tool']])
25
+	|| !isset($_GET['data'])
26 26
 ) {
27
-    header("HTTP/1.1 403 Forbidden");
27
+	header("HTTP/1.1 403 Forbidden");
28 28
 
29
-    return;
29
+	return;
30 30
 }
31 31
 
32 32
 if (isset($_GET['round2'])) {
33
-    $data = $_GET['data'];
34
-    $tool = $_GET['tool'];
33
+	$data = $_GET['data'];
34
+	$tool = $_GET['tool'];
35 35
 
36
-    if ($tool === 'domain') {
37
-        // quick security check - if you want to exploit something, you better be sure your exploit resolves via dns.
38
-        // this is not intended to catch everything, just as a quick sanity check.
39
-        if (gethostbyname($data) == $data) {
40
-            echo 'Error resolving hostname, it doesn\'t look like this domain exists.';
41
-            die();
42
-        }
43
-    }
44
-    else {
45
-        $data = urlencode($data);
46
-    }
36
+	if ($tool === 'domain') {
37
+		// quick security check - if you want to exploit something, you better be sure your exploit resolves via dns.
38
+		// this is not intended to catch everything, just as a quick sanity check.
39
+		if (gethostbyname($data) == $data) {
40
+			echo 'Error resolving hostname, it doesn\'t look like this domain exists.';
41
+			die();
42
+		}
43
+	}
44
+	else {
45
+		$data = urlencode($data);
46
+	}
47 47
 
48
-    echo '<script>window.location.href=' . json_encode(str_replace("%DATA%", $data, $toolList[$tool])) . '</script>';
48
+	echo '<script>window.location.href=' . json_encode(str_replace("%DATA%", $data, $toolList[$tool])) . '</script>';
49 49
 }
50 50
 else {
51
-    header("Location: " . $_SERVER["REQUEST_URI"] . "&round2=true");
51
+	header("Location: " . $_SERVER["REQUEST_URI"] . "&round2=true");
52 52
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,13 +40,11 @@
 block discarded – undo
40 40
             echo 'Error resolving hostname, it doesn\'t look like this domain exists.';
41 41
             die();
42 42
         }
43
-    }
44
-    else {
43
+    } else {
45 44
         $data = urlencode($data);
46 45
     }
47 46
 
48 47
     echo '<script>window.location.href=' . json_encode(str_replace("%DATA%", $data, $toolList[$tool])) . '</script>';
49
-}
50
-else {
48
+} else {
51 49
     header("Location: " . $_SERVER["REQUEST_URI"] . "&round2=true");
52 50
 }
Please login to merge, or discard this patch.
smarty-plugins/modifier.iphex.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -13,17 +13,17 @@
 block discarded – undo
13 13
  */
14 14
 function smarty_modifier_iphex($input)
15 15
 {
16
-    $output = $input;
16
+	$output = $input;
17 17
 
18
-    if (filter_var($input, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false) {
19
-        $octets = explode('.', $input);
20
-        $output = '';
21
-        foreach ($octets as $octet) {
22
-            $output .= str_pad(dechex($octet), 2, '0', STR_PAD_LEFT);
23
-        }
18
+	if (filter_var($input, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false) {
19
+		$octets = explode('.', $input);
20
+		$output = '';
21
+		foreach ($octets as $octet) {
22
+			$output .= str_pad(dechex($octet), 2, '0', STR_PAD_LEFT);
23
+		}
24 24
 
25
-        $output = str_pad($output, 32, '0', STR_PAD_LEFT);
26
-    }
25
+		$output = str_pad($output, 32, '0', STR_PAD_LEFT);
26
+	}
27 27
 
28
-    return $output;
28
+	return $output;
29 29
 }
Please login to merge, or discard this patch.
smarty-plugins/modifier.nlimplode.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@
 block discarded – undo
14 14
 
15 15
 function smarty_modifier_nlimplode($list, $conjunction = 'or')
16 16
 {
17
-    $last = array_pop($list);
18
-    if ($list) {
19
-        return implode(', ', $list) . ', ' . $conjunction . ' ' . $last;
20
-    }
21
-    return $last;
17
+	$last = array_pop($list);
18
+	if ($list) {
19
+		return implode(', ', $list) . ', ' . $conjunction . ' ' . $last;
20
+	}
21
+	return $last;
22 22
 }
23 23
\ No newline at end of file
Please login to merge, or discard this patch.
smarty-plugins/modifier.relativedate.php 3 patches
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -16,73 +16,73 @@
 block discarded – undo
16 16
  */
17 17
 function smarty_modifier_relativedate($input)
18 18
 {
19
-    $now = new DateTime();
19
+	$now = new DateTime();
20 20
 
21
-    if (gettype($input) === 'object'
22
-        && (get_class($input) === DateTime::class || get_class($input) === DateTimeImmutable::class)
23
-    ) {
24
-        $then = $input;
25
-    }
26
-    else {
27
-        try {
28
-            $then = new DateTime($input);
29
-        }
30
-        catch(Exception $ex) {
31
-            return $input;
32
-        }
33
-    }
21
+	if (gettype($input) === 'object'
22
+		&& (get_class($input) === DateTime::class || get_class($input) === DateTimeImmutable::class)
23
+	) {
24
+		$then = $input;
25
+	}
26
+	else {
27
+		try {
28
+			$then = new DateTime($input);
29
+		}
30
+		catch(Exception $ex) {
31
+			return $input;
32
+		}
33
+	}
34 34
 
35
-    $secs = $now->getTimestamp() - $then->getTimestamp();
35
+	$secs = $now->getTimestamp() - $then->getTimestamp();
36 36
 
37
-    $second = 1;
38
-    $minute = 60 * $second;
39
-    $minuteCut = 60 * $second;
40
-    $hour = 60 * $minute;
41
-    $hourCut = 90 * $minute;
42
-    $day = 24 * $hour;
43
-    $dayCut = 48 * $hour;
44
-    $week = 7 * $day;
45
-    $weekCut = 14 * $day;
46
-    $month = 30 * $day;
47
-    $monthCut = 60 * $day;
48
-    $year = 365 * $day;
49
-    $yearCut = $year * 2;
37
+	$second = 1;
38
+	$minute = 60 * $second;
39
+	$minuteCut = 60 * $second;
40
+	$hour = 60 * $minute;
41
+	$hourCut = 90 * $minute;
42
+	$day = 24 * $hour;
43
+	$dayCut = 48 * $hour;
44
+	$week = 7 * $day;
45
+	$weekCut = 14 * $day;
46
+	$month = 30 * $day;
47
+	$monthCut = 60 * $day;
48
+	$year = 365 * $day;
49
+	$yearCut = $year * 2;
50 50
 
51
-    $pluralise = true;
51
+	$pluralise = true;
52 52
 
53
-    if ($secs <= 10) {
54
-        $output = "just now";
55
-        $pluralise = false;
56
-    }
57
-    elseif ($secs > 10 && $secs < $minuteCut) {
58
-        $output = round($secs / $second) . " second";
59
-    }
60
-    elseif ($secs >= $minuteCut && $secs < $hourCut) {
61
-        $output = round($secs / $minute) . " minute";
62
-    }
63
-    elseif ($secs >= $hourCut && $secs < $dayCut) {
64
-        $output = round($secs / $hour) . " hour";
65
-    }
66
-    elseif ($secs >= $dayCut && $secs < $weekCut) {
67
-        $output = round($secs / $day) . " day";
68
-    }
69
-    elseif ($secs >= $weekCut && $secs < $monthCut) {
70
-        $output = round($secs / $week) . " week";
71
-    }
72
-    elseif ($secs >= $monthCut && $secs < $yearCut) {
73
-        $output = round($secs / $month) . " month";
74
-    }
75
-    elseif ($secs >= $yearCut && $secs < $year * 10) {
76
-        $output = round($secs / $year) . " year";
77
-    }
78
-    else {
79
-        $output = "a long time ago";
80
-        $pluralise = false;
81
-    }
53
+	if ($secs <= 10) {
54
+		$output = "just now";
55
+		$pluralise = false;
56
+	}
57
+	elseif ($secs > 10 && $secs < $minuteCut) {
58
+		$output = round($secs / $second) . " second";
59
+	}
60
+	elseif ($secs >= $minuteCut && $secs < $hourCut) {
61
+		$output = round($secs / $minute) . " minute";
62
+	}
63
+	elseif ($secs >= $hourCut && $secs < $dayCut) {
64
+		$output = round($secs / $hour) . " hour";
65
+	}
66
+	elseif ($secs >= $dayCut && $secs < $weekCut) {
67
+		$output = round($secs / $day) . " day";
68
+	}
69
+	elseif ($secs >= $weekCut && $secs < $monthCut) {
70
+		$output = round($secs / $week) . " week";
71
+	}
72
+	elseif ($secs >= $monthCut && $secs < $yearCut) {
73
+		$output = round($secs / $month) . " month";
74
+	}
75
+	elseif ($secs >= $yearCut && $secs < $year * 10) {
76
+		$output = round($secs / $year) . " year";
77
+	}
78
+	else {
79
+		$output = "a long time ago";
80
+		$pluralise = false;
81
+	}
82 82
 
83
-    if ($pluralise) {
84
-        $output = (substr($output, 0, 2) <> "1 ") ? $output . "s ago" : $output . " ago";
85
-    }
83
+	if ($pluralise) {
84
+		$output = (substr($output, 0, 2) <> "1 ") ? $output . "s ago" : $output . " ago";
85
+	}
86 86
 
87
-    return $output;
87
+	return $output;
88 88
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
         try {
28 28
             $then = new DateTime($input);
29 29
         }
30
-        catch(Exception $ex) {
30
+        catch (Exception $ex) {
31 31
             return $input;
32 32
         }
33 33
     }
Please login to merge, or discard this patch.
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@  discard block
 block discarded – undo
22 22
         && (get_class($input) === DateTime::class || get_class($input) === DateTimeImmutable::class)
23 23
     ) {
24 24
         $then = $input;
25
-    }
26
-    else {
25
+    } else {
27 26
         try {
28 27
             $then = new DateTime($input);
29 28
         }
@@ -53,29 +52,21 @@  discard block
 block discarded – undo
53 52
     if ($secs <= 10) {
54 53
         $output = "just now";
55 54
         $pluralise = false;
56
-    }
57
-    elseif ($secs > 10 && $secs < $minuteCut) {
55
+    } elseif ($secs > 10 && $secs < $minuteCut) {
58 56
         $output = round($secs / $second) . " second";
59
-    }
60
-    elseif ($secs >= $minuteCut && $secs < $hourCut) {
57
+    } elseif ($secs >= $minuteCut && $secs < $hourCut) {
61 58
         $output = round($secs / $minute) . " minute";
62
-    }
63
-    elseif ($secs >= $hourCut && $secs < $dayCut) {
59
+    } elseif ($secs >= $hourCut && $secs < $dayCut) {
64 60
         $output = round($secs / $hour) . " hour";
65
-    }
66
-    elseif ($secs >= $dayCut && $secs < $weekCut) {
61
+    } elseif ($secs >= $dayCut && $secs < $weekCut) {
67 62
         $output = round($secs / $day) . " day";
68
-    }
69
-    elseif ($secs >= $weekCut && $secs < $monthCut) {
63
+    } elseif ($secs >= $weekCut && $secs < $monthCut) {
70 64
         $output = round($secs / $week) . " week";
71
-    }
72
-    elseif ($secs >= $monthCut && $secs < $yearCut) {
65
+    } elseif ($secs >= $monthCut && $secs < $yearCut) {
73 66
         $output = round($secs / $month) . " month";
74
-    }
75
-    elseif ($secs >= $yearCut && $secs < $year * 10) {
67
+    } elseif ($secs >= $yearCut && $secs < $year * 10) {
76 68
         $output = round($secs / $year) . " year";
77
-    }
78
-    else {
69
+    } else {
79 70
         $output = "a long time ago";
80 71
         $pluralise = false;
81 72
     }
Please login to merge, or discard this patch.
smarty-plugins/modifier.demodhex.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@
 block discarded – undo
13 13
  */
14 14
 function smarty_modifier_demodhex($input)
15 15
 {
16
-    $hex = preg_replace(
17
-        array('/c/', '/b/', '/d/', '/e/', '/f/', '/g/', '/h/', '/i/', '/j/', '/k/', '/l/', '/n/', '/r/', '/t/', '/u/', '/v/'),
18
-        array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'),
19
-        $input);
16
+	$hex = preg_replace(
17
+		array('/c/', '/b/', '/d/', '/e/', '/f/', '/g/', '/h/', '/i/', '/j/', '/k/', '/l/', '/n/', '/r/', '/t/', '/u/', '/v/'),
18
+		array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'),
19
+		$input);
20 20
 
21
-    return hexdec($hex);
21
+	return hexdec($hex);
22 22
 }
23 23
\ No newline at end of file
Please login to merge, or discard this patch.
includes/Security/EncryptionHelper.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -12,48 +12,48 @@
 block discarded – undo
12 12
 
13 13
 class EncryptionHelper
14 14
 {
15
-    /**
16
-     * @var SiteConfiguration
17
-     */
18
-    private $configuration;
19
-
20
-    /**
21
-     * EncryptionHelper constructor.
22
-     *
23
-     * @param SiteConfiguration $configuration
24
-     */
25
-    public function __construct(SiteConfiguration $configuration)
26
-    {
27
-        $this->configuration = $configuration;
28
-    }
29
-
30
-    public function encryptData($secret)
31
-    {
32
-        $iv = openssl_random_pseudo_bytes(16);
33
-        $password = $this->getEncryptionKey();
34
-        $encryptedKey = openssl_encrypt($secret, 'aes-256-ctr', $password, OPENSSL_RAW_DATA, $iv);
35
-
36
-        $data = base64_encode($iv) . '|' . base64_encode($encryptedKey);
37
-
38
-        return $data;
39
-    }
40
-
41
-    public function decryptData($data)
42
-    {
43
-        list($iv, $encryptedKey) = array_map('base64_decode', explode('|', $data));
44
-
45
-        $password = $this->getEncryptionKey();
46
-
47
-        $secret = openssl_decrypt($encryptedKey, 'aes-256-ctr', $password, OPENSSL_RAW_DATA, $iv);
48
-
49
-        return $secret;
50
-    }
51
-
52
-    /**
53
-     * @return string
54
-     */
55
-    private function getEncryptionKey()
56
-    {
57
-        return openssl_digest($this->configuration->getTotpEncryptionKey(), 'sha256');
58
-    }
15
+	/**
16
+	 * @var SiteConfiguration
17
+	 */
18
+	private $configuration;
19
+
20
+	/**
21
+	 * EncryptionHelper constructor.
22
+	 *
23
+	 * @param SiteConfiguration $configuration
24
+	 */
25
+	public function __construct(SiteConfiguration $configuration)
26
+	{
27
+		$this->configuration = $configuration;
28
+	}
29
+
30
+	public function encryptData($secret)
31
+	{
32
+		$iv = openssl_random_pseudo_bytes(16);
33
+		$password = $this->getEncryptionKey();
34
+		$encryptedKey = openssl_encrypt($secret, 'aes-256-ctr', $password, OPENSSL_RAW_DATA, $iv);
35
+
36
+		$data = base64_encode($iv) . '|' . base64_encode($encryptedKey);
37
+
38
+		return $data;
39
+	}
40
+
41
+	public function decryptData($data)
42
+	{
43
+		list($iv, $encryptedKey) = array_map('base64_decode', explode('|', $data));
44
+
45
+		$password = $this->getEncryptionKey();
46
+
47
+		$secret = openssl_decrypt($encryptedKey, 'aes-256-ctr', $password, OPENSSL_RAW_DATA, $iv);
48
+
49
+		return $secret;
50
+	}
51
+
52
+	/**
53
+	 * @return string
54
+	 */
55
+	private function getEncryptionKey()
56
+	{
57
+		return openssl_digest($this->configuration->getTotpEncryptionKey(), 'sha256');
58
+	}
59 59
 }
60 60
\ No newline at end of file
Please login to merge, or discard this patch.
includes/Security/ContentSecurityPolicyManager.php 2 patches
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -12,100 +12,100 @@
 block discarded – undo
12 12
 
13 13
 class ContentSecurityPolicyManager
14 14
 {
15
-    private $policy = [
16
-        'default-src'     => [],
17
-        'script-src'      => ['self', 'nonce'],
18
-        'script-src-elem' => ['self', 'nonce'],
19
-        'script-src-attr' => [],
20
-        'connect-src'     => ['self'],
21
-        'style-src'       => ['self'],
22
-        'style-src-elem'  => ['self'],
23
-        'style-src-attr'  => [],
24
-        'img-src'         => ['self', 'data:', 'https://upload.wikimedia.org', 'https://accounts-dev.wmflabs.org/'],
25
-        'font-src'        => ['self'],
26
-        'form-action'     => ['self', 'oauth'],
27
-        'frame-ancestors' => [],
28
-    ];
29
-    private $nonce = null;
30
-    private $reportOnly = false;
31
-    /**
32
-     * @var SiteConfiguration
33
-     */
34
-    private $configuration;
15
+	private $policy = [
16
+		'default-src'     => [],
17
+		'script-src'      => ['self', 'nonce'],
18
+		'script-src-elem' => ['self', 'nonce'],
19
+		'script-src-attr' => [],
20
+		'connect-src'     => ['self'],
21
+		'style-src'       => ['self'],
22
+		'style-src-elem'  => ['self'],
23
+		'style-src-attr'  => [],
24
+		'img-src'         => ['self', 'data:', 'https://upload.wikimedia.org', 'https://accounts-dev.wmflabs.org/'],
25
+		'font-src'        => ['self'],
26
+		'form-action'     => ['self', 'oauth'],
27
+		'frame-ancestors' => [],
28
+	];
29
+	private $nonce = null;
30
+	private $reportOnly = false;
31
+	/**
32
+	 * @var SiteConfiguration
33
+	 */
34
+	private $configuration;
35 35
 
36
-    /**
37
-     * ContentSecurityPolicyManager constructor.
38
-     *
39
-     * @param SiteConfiguration $configuration
40
-     */
41
-    public function __construct(SiteConfiguration $configuration)
42
-    {
43
-        $this->configuration = $configuration;
44
-    }
36
+	/**
37
+	 * ContentSecurityPolicyManager constructor.
38
+	 *
39
+	 * @param SiteConfiguration $configuration
40
+	 */
41
+	public function __construct(SiteConfiguration $configuration)
42
+	{
43
+		$this->configuration = $configuration;
44
+	}
45 45
 
46
-    public function getNonce()
47
-    {
48
-        if ($this->nonce === null) {
49
-            $this->nonce = base64_encode(openssl_random_pseudo_bytes(32));
50
-        }
46
+	public function getNonce()
47
+	{
48
+		if ($this->nonce === null) {
49
+			$this->nonce = base64_encode(openssl_random_pseudo_bytes(32));
50
+		}
51 51
 
52
-        return $this->nonce;
53
-    }
52
+		return $this->nonce;
53
+	}
54 54
 
55
-    public function getHeader(): string
56
-    {
57
-        $reportOnly = '';
58
-        if ($this->reportOnly) {
59
-            $reportOnly = '-Report-Only';
60
-        }
55
+	public function getHeader(): string
56
+	{
57
+		$reportOnly = '';
58
+		if ($this->reportOnly) {
59
+			$reportOnly = '-Report-Only';
60
+		}
61 61
 
62
-        $constructedPolicy = "Content-Security-Policy{$reportOnly}: ";
62
+		$constructedPolicy = "Content-Security-Policy{$reportOnly}: ";
63 63
 
64
-        foreach ($this->policy as $item => $values) {
65
-            $constructedPolicy .= $item . ' ';
66
-            $policyIsSet = false;
64
+		foreach ($this->policy as $item => $values) {
65
+			$constructedPolicy .= $item . ' ';
66
+			$policyIsSet = false;
67 67
 
68
-            if (count($values) > 0) {
69
-                foreach ($values as $value) {
70
-                    switch ($value) {
71
-                        case 'none':
72
-                        case 'self':
73
-                        case 'strict-dynamic':
74
-                            $policyIsSet = true;
75
-                            $constructedPolicy .= "'{$value}' ";
76
-                            break;
77
-                        case 'nonce':
78
-                            if ($this->nonce !== null) {
79
-                                $policyIsSet = true;
80
-                                $constructedPolicy .= "'nonce-{$this->nonce}' ";
81
-                            }
82
-                            break;
83
-                        case 'oauth':
84
-                            $policyIsSet = true;
85
-                            $constructedPolicy .= "{$this->configuration->getOauthMediaWikiCanonicalServer()} ";
86
-                            break;
87
-                        default:
88
-                            $policyIsSet = true;
89
-                            $constructedPolicy .= $value . ' ';
90
-                            break;
91
-                    }
92
-                }
68
+			if (count($values) > 0) {
69
+				foreach ($values as $value) {
70
+					switch ($value) {
71
+						case 'none':
72
+						case 'self':
73
+						case 'strict-dynamic':
74
+							$policyIsSet = true;
75
+							$constructedPolicy .= "'{$value}' ";
76
+							break;
77
+						case 'nonce':
78
+							if ($this->nonce !== null) {
79
+								$policyIsSet = true;
80
+								$constructedPolicy .= "'nonce-{$this->nonce}' ";
81
+							}
82
+							break;
83
+						case 'oauth':
84
+							$policyIsSet = true;
85
+							$constructedPolicy .= "{$this->configuration->getOauthMediaWikiCanonicalServer()} ";
86
+							break;
87
+						default:
88
+							$policyIsSet = true;
89
+							$constructedPolicy .= $value . ' ';
90
+							break;
91
+					}
92
+				}
93 93
 
94
-                if (!$policyIsSet) {
95
-                    $constructedPolicy .= "'none' ";
96
-                }
97
-            }
98
-            else {
99
-                $constructedPolicy .= "'none' ";
100
-            }
94
+				if (!$policyIsSet) {
95
+					$constructedPolicy .= "'none' ";
96
+				}
97
+			}
98
+			else {
99
+				$constructedPolicy .= "'none' ";
100
+			}
101 101
 
102
-            $constructedPolicy .= '; ';
103
-        }
102
+			$constructedPolicy .= '; ';
103
+		}
104 104
 
105
-        if ($this->configuration->getCspReportUri() !== null) {
106
-            $constructedPolicy .= 'report-uri ' . $this->configuration->getCspReportUri();
107
-        }
105
+		if ($this->configuration->getCspReportUri() !== null) {
106
+			$constructedPolicy .= 'report-uri ' . $this->configuration->getCspReportUri();
107
+		}
108 108
 
109
-        return $constructedPolicy;
110
-    }
109
+		return $constructedPolicy;
110
+	}
111 111
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -94,8 +94,7 @@
 block discarded – undo
94 94
                 if (!$policyIsSet) {
95 95
                     $constructedPolicy .= "'none' ";
96 96
                 }
97
-            }
98
-            else {
97
+            } else {
99 98
                 $constructedPolicy .= "'none' ";
100 99
             }
101 100
 
Please login to merge, or discard this patch.