Passed
Push — release-2.1 ( fa03a5...8f939c )
by Mathias
06:50
created
Sources/Subs-Editor.php 1 patch
Braces   -3 removed lines patch added patch discarded remove patch
@@ -310,7 +310,6 @@  discard block
 block discarded – undo
310 310
 					$replacement .= $precedingStyle . $extra_attr . $afterStyle;
311 311
 			}
312 312
 		}
313
-
314 313
 		elseif (preg_match('~</([A-Za-z]+)>~', $part, $matches) === 1)
315 314
 		{
316 315
 			// Is this the element that we've been waiting for to be closed?
@@ -570,7 +569,6 @@  discard block
 block discarded – undo
570 569
 							$parts[$i + 2] = str_repeat("\t", $listDepth) . '[/list]';
571 570
 							$parts[$i + 3] = '';
572 571
 						}
573
-
574 572
 						else
575 573
 						{
576 574
 							// We're in a list item.
@@ -609,7 +607,6 @@  discard block
 block discarded – undo
609 607
 							$parts[$i + 2] = '';
610 608
 							$parts[$i + 3] = '';
611 609
 						}
612
-
613 610
 						else
614 611
 						{
615 612
 							// Remove the trailing breaks from the list item.
Please login to merge, or discard this patch.
Sources/Class-Graphics.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -280,7 +280,7 @@
 block discarded – undo
280 280
 			$ret .=
281 281
 				chr(($this->m_arColors[$i] & 0x000000FF)) . // R
282 282
 				chr(($this->m_arColors[$i] & 0x0000FF00) >> 8) . // G
283
-				chr(($this->m_arColors[$i] & 0x00FF0000) >> 16);  // B
283
+				chr(($this->m_arColors[$i] & 0x00FF0000) >> 16); // B
284 284
 		}
285 285
 
286 286
 		return $ret;
Please login to merge, or discard this patch.
Sources/Load.php 1 patch
Braces   +1 added lines, -6 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	// Set a list of common functions.
99 99
 	$ent_list = '&(?:#' . (empty($modSettings['disableEntityCheck']) ? '\d{1,7}' : '021') . '|quot|amp|lt|gt|nbsp);';
100 100
 	$ent_check = empty($modSettings['disableEntityCheck']) ? function($string)
101
-		{
101
+	{
102 102
 			$string = preg_replace_callback('~(&#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', $string);
103 103
 			return $string;
104 104
 		} : function($string)
@@ -2147,7 +2147,6 @@  discard block
 block discarded – undo
2147 2147
 		loadLanguage('index+Modifications');
2148 2148
 		$context['template_layers'] = array();
2149 2149
 	}
2150
-
2151 2150
 	else
2152 2151
 	{
2153 2152
 		// Custom templates to load, or just default?
@@ -2525,14 +2524,12 @@  discard block
 block discarded – undo
2525 2524
 				$fileUrl = $settings['default_theme_url'] . '/css/' . $fileName;
2526 2525
 				$filePath = $settings['default_theme_dir'] . '/css/' . $fileName;
2527 2526
 			}
2528
-
2529 2527
 			else
2530 2528
 			{
2531 2529
 				$fileUrl = false;
2532 2530
 				$filePath = false;
2533 2531
 			}
2534 2532
 		}
2535
-
2536 2533
 		else
2537 2534
 		{
2538 2535
 			$fileUrl = $settings[$themeRef . '_url'] . '/css/' . $fileName;
@@ -2639,14 +2636,12 @@  discard block
 block discarded – undo
2639 2636
 				$fileUrl = $settings['default_theme_url'] . '/scripts/' . $fileName;
2640 2637
 				$filePath = $settings['default_theme_dir'] . '/scripts/' . $fileName;
2641 2638
 			}
2642
-
2643 2639
 			else
2644 2640
 			{
2645 2641
 				$fileUrl = false;
2646 2642
 				$filePath = false;
2647 2643
 			}
2648 2644
 		}
2649
-
2650 2645
 		else
2651 2646
 		{
2652 2647
 			$fileUrl = $settings[$themeRef . '_url'] . '/scripts/' . $fileName;
Please login to merge, or discard this patch.
Sources/Subs-Post.php 1 patch
Braces   -1 removed lines patch added patch discarded remove patch
@@ -1254,7 +1254,6 @@
 block discarded – undo
1254 1254
 
1255 1255
 		return array($charset, $string, 'base64');
1256 1256
 	}
1257
-
1258 1257
 	else
1259 1258
 		return array($charset, $string, '7bit');
1260 1259
 }
Please login to merge, or discard this patch.
Sources/ManageSmileys.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1997,7 +1997,7 @@
 block discarded – undo
1997 1997
 	// Remove anything that isn't actually new from our list of files
1998 1998
 	foreach ($to_unset as $key => $ids)
1999 1999
 	{
2000
-		if (array_reduce($ids, function ($carry, $item) { return $carry * $item; }, true) == true)
2000
+		if (array_reduce($ids, function($carry, $item) { return $carry * $item; }, true) == true)
2001 2001
 			unset($smiley_files[$key]);
2002 2002
 	}
2003 2003
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1997,7 +1997,9 @@
 block discarded – undo
1997 1997
 	// Remove anything that isn't actually new from our list of files
1998 1998
 	foreach ($to_unset as $key => $ids)
1999 1999
 	{
2000
-		if (array_reduce($ids, function ($carry, $item) { return $carry * $item; }, true) == true)
2000
+		if (array_reduce($ids, function ($carry, $item)
2001
+		{
2002
+return $carry * $item; }, true) == true)
2001 2003
 			unset($smiley_files[$key]);
2002 2004
 	}
2003 2005
 
Please login to merge, or discard this patch.
Sources/Class-Punycode.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 				}
146 146
 				if ($c === $n) {
147 147
 					$q = $delta;
148
-					for ($k = static::BASE;; $k += static::BASE) {
148
+					for ($k = static::BASE; ; $k += static::BASE) {
149 149
 						$t = $this->calculateThreshold($k, $bias);
150 150
 						if ($q < $t) {
151 151
 							break;
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 			$oldi = $i;
228 228
 			$w = 1;
229 229
 
230
-			for ($k = static::BASE;; $k += static::BASE)
230
+			for ($k = static::BASE; ; $k += static::BASE)
231 231
 			{
232 232
 				$digit = static::$decodeTable[$input[$pos++]];
233 233
 				$i = $i + ($digit * $w);
Please login to merge, or discard this patch.
Braces   +20 added lines, -10 removed lines patch added patch discarded remove patch
@@ -94,7 +94,8 @@  discard block
 block discarded – undo
94 94
 	{
95 95
 		$input = mb_strtolower($input, $this->encoding);
96 96
 		$parts = explode('.', $input);
97
-		foreach ($parts as &$part) {
97
+		foreach ($parts as &$part)
98
+		{
98 99
 			$part = $this->encodePart($part);
99 100
 		}
100 101
 		$output = implode('.', $parts);
@@ -119,13 +120,16 @@  discard block
 block discarded – undo
119 120
 		$h = $b = count($codePoints['basic']);
120 121
 
121 122
 		$output = '';
122
-		foreach ($codePoints['basic'] as $code) {
123
+		foreach ($codePoints['basic'] as $code)
124
+		{
123 125
 			$output .= $this->codePointToChar($code);
124 126
 		}
125
-		if ($input === $output) {
127
+		if ($input === $output)
128
+		{
126 129
 			return $output;
127 130
 		}
128
-		if ($b > 0) {
131
+		if ($b > 0)
132
+		{
129 133
 			$output .= static::DELIMITER;
130 134
 		}
131 135
 
@@ -134,20 +138,26 @@  discard block
 block discarded – undo
134 138
 
135 139
 		$i = 0;
136 140
 		$length = mb_strlen($input, $this->encoding);
137
-		while ($h < $length) {
141
+		while ($h < $length)
142
+		{
138 143
 			$m = $codePoints['nonBasic'][$i++];
139 144
 			$delta = $delta + ($m - $n) * ($h + 1);
140 145
 			$n = $m;
141 146
 
142
-			foreach ($codePoints['all'] as $c) {
143
-				if ($c < $n || $c < static::INITIAL_N) {
147
+			foreach ($codePoints['all'] as $c)
148
+			{
149
+				if ($c < $n || $c < static::INITIAL_N)
150
+				{
144 151
 					$delta++;
145 152
 				}
146
-				if ($c === $n) {
153
+				if ($c === $n)
154
+				{
147 155
 					$q = $delta;
148
-					for ($k = static::BASE;; $k += static::BASE) {
156
+					for ($k = static::BASE;; $k += static::BASE)
157
+					{
149 158
 						$t = $this->calculateThreshold($k, $bias);
150
-						if ($q < $t) {
159
+						if ($q < $t)
160
+						{
151 161
 							break;
152 162
 						}
153 163
 
Please login to merge, or discard this patch.
Sources/random_compat/random_bytes_mcrypt.php 2 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -27,53 +27,53 @@
 block discarded – undo
27 27
  */
28 28
 
29 29
 if (!is_callable('random_bytes')) {
30
-    /**
31
-     * Powered by ext/mcrypt (and thankfully NOT libmcrypt)
32
-     *
33
-     * @ref https://bugs.php.net/bug.php?id=55169
34
-     * @ref https://github.com/php/php-src/blob/c568ffe5171d942161fc8dda066bce844bdef676/ext/mcrypt/mcrypt.c#L1321-L1386
35
-     *
36
-     * @param int $bytes
37
-     *
38
-     * @throws Exception
39
-     *
40
-     * @return string
41
-     */
42
-    function random_bytes($bytes)
43
-    {
44
-        try {
45
-            /** @var int $bytes */
46
-            $bytes = RandomCompat_intval($bytes);
47
-        } catch (TypeError $ex) {
48
-            throw new TypeError(
49
-                'random_bytes(): $bytes must be an integer'
50
-            );
51
-        }
30
+	/**
31
+	 * Powered by ext/mcrypt (and thankfully NOT libmcrypt)
32
+	 *
33
+	 * @ref https://bugs.php.net/bug.php?id=55169
34
+	 * @ref https://github.com/php/php-src/blob/c568ffe5171d942161fc8dda066bce844bdef676/ext/mcrypt/mcrypt.c#L1321-L1386
35
+	 *
36
+	 * @param int $bytes
37
+	 *
38
+	 * @throws Exception
39
+	 *
40
+	 * @return string
41
+	 */
42
+	function random_bytes($bytes)
43
+	{
44
+		try {
45
+			/** @var int $bytes */
46
+			$bytes = RandomCompat_intval($bytes);
47
+		} catch (TypeError $ex) {
48
+			throw new TypeError(
49
+				'random_bytes(): $bytes must be an integer'
50
+			);
51
+		}
52 52
 
53
-        if ($bytes < 1) {
54
-            throw new Error(
55
-                'Length must be greater than 0'
56
-            );
57
-        }
53
+		if ($bytes < 1) {
54
+			throw new Error(
55
+				'Length must be greater than 0'
56
+			);
57
+		}
58 58
 
59
-        /** @var string|bool $buf */
60
-        $buf = @mcrypt_create_iv((int) $bytes, (int) MCRYPT_DEV_URANDOM);
61
-        if (
62
-            is_string($buf)
63
-                &&
64
-            RandomCompat_strlen($buf) === $bytes
65
-        ) {
66
-            /**
67
-             * Return our random entropy buffer here:
68
-             */
69
-            return $buf;
70
-        }
59
+		/** @var string|bool $buf */
60
+		$buf = @mcrypt_create_iv((int) $bytes, (int) MCRYPT_DEV_URANDOM);
61
+		if (
62
+			is_string($buf)
63
+				&&
64
+			RandomCompat_strlen($buf) === $bytes
65
+		) {
66
+			/**
67
+			 * Return our random entropy buffer here:
68
+			 */
69
+			return $buf;
70
+		}
71 71
 
72
-        /**
73
-         * If we reach here, PHP has failed us.
74
-         */
75
-        throw new Exception(
76
-            'Could not gather sufficient random data'
77
-        );
78
-    }
72
+		/**
73
+		 * If we reach here, PHP has failed us.
74
+		 */
75
+		throw new Exception(
76
+			'Could not gather sufficient random data'
77
+		);
78
+	}
79 79
 }
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,7 +26,8 @@  discard block
 block discarded – undo
26 26
  * SOFTWARE.
27 27
  */
28 28
 
29
-if (!is_callable('random_bytes')) {
29
+if (!is_callable('random_bytes'))
30
+{
30 31
     /**
31 32
      * Powered by ext/mcrypt (and thankfully NOT libmcrypt)
32 33
      *
@@ -41,16 +42,20 @@  discard block
 block discarded – undo
41 42
      */
42 43
     function random_bytes($bytes)
43 44
     {
44
-        try {
45
+        try
46
+        {
45 47
             /** @var int $bytes */
46 48
             $bytes = RandomCompat_intval($bytes);
47
-        } catch (TypeError $ex) {
49
+        }
50
+        catch (TypeError $ex)
51
+        {
48 52
             throw new TypeError(
49 53
                 'random_bytes(): $bytes must be an integer'
50 54
             );
51 55
         }
52 56
 
53
-        if ($bytes < 1) {
57
+        if ($bytes < 1)
58
+        {
54 59
             throw new Error(
55 60
                 'Length must be greater than 0'
56 61
             );
Please login to merge, or discard this patch.
Sources/random_compat/random_bytes_com_dotnet.php 2 patches
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -27,65 +27,65 @@
 block discarded – undo
27 27
  */
28 28
 
29 29
 if (!is_callable('random_bytes')) {
30
-    /**
31
-     * Windows with PHP < 5.3.0 will not have the function
32
-     * openssl_random_pseudo_bytes() available, so let's use
33
-     * CAPICOM to work around this deficiency.
34
-     *
35
-     * @param int $bytes
36
-     *
37
-     * @throws Exception
38
-     *
39
-     * @return string
40
-     */
41
-    function random_bytes($bytes)
42
-    {
43
-        try {
44
-            /** @var int $bytes */
45
-            $bytes = RandomCompat_intval($bytes);
46
-        } catch (TypeError $ex) {
47
-            throw new TypeError(
48
-                'random_bytes(): $bytes must be an integer'
49
-            );
50
-        }
30
+	/**
31
+	 * Windows with PHP < 5.3.0 will not have the function
32
+	 * openssl_random_pseudo_bytes() available, so let's use
33
+	 * CAPICOM to work around this deficiency.
34
+	 *
35
+	 * @param int $bytes
36
+	 *
37
+	 * @throws Exception
38
+	 *
39
+	 * @return string
40
+	 */
41
+	function random_bytes($bytes)
42
+	{
43
+		try {
44
+			/** @var int $bytes */
45
+			$bytes = RandomCompat_intval($bytes);
46
+		} catch (TypeError $ex) {
47
+			throw new TypeError(
48
+				'random_bytes(): $bytes must be an integer'
49
+			);
50
+		}
51 51
 
52
-        if ($bytes < 1) {
53
-            throw new Error(
54
-                'Length must be greater than 0'
55
-            );
56
-        }
52
+		if ($bytes < 1) {
53
+			throw new Error(
54
+				'Length must be greater than 0'
55
+			);
56
+		}
57 57
 
58
-        /** @var string $buf */
59
-        $buf = '';
60
-        if (!class_exists('COM')) {
61
-            throw new Error(
62
-                'COM does not exist'
63
-            );
64
-        }
65
-        /** @var COM $util */
66
-        $util = new COM('CAPICOM.Utilities.1');
67
-        $execCount = 0;
58
+		/** @var string $buf */
59
+		$buf = '';
60
+		if (!class_exists('COM')) {
61
+			throw new Error(
62
+				'COM does not exist'
63
+			);
64
+		}
65
+		/** @var COM $util */
66
+		$util = new COM('CAPICOM.Utilities.1');
67
+		$execCount = 0;
68 68
 
69
-        /**
70
-         * Let's not let it loop forever. If we run N times and fail to
71
-         * get N bytes of random data, then CAPICOM has failed us.
72
-         */
73
-        do {
74
-            $buf .= base64_decode((string) $util->GetRandom($bytes, 0));
75
-            if (RandomCompat_strlen($buf) >= $bytes) {
76
-                /**
77
-                 * Return our random entropy buffer here:
78
-                 */
79
-                return (string) RandomCompat_substr($buf, 0, $bytes);
80
-            }
81
-            ++$execCount;
82
-        } while ($execCount < $bytes);
69
+		/**
70
+		 * Let's not let it loop forever. If we run N times and fail to
71
+		 * get N bytes of random data, then CAPICOM has failed us.
72
+		 */
73
+		do {
74
+			$buf .= base64_decode((string) $util->GetRandom($bytes, 0));
75
+			if (RandomCompat_strlen($buf) >= $bytes) {
76
+				/**
77
+				 * Return our random entropy buffer here:
78
+				 */
79
+				return (string) RandomCompat_substr($buf, 0, $bytes);
80
+			}
81
+			++$execCount;
82
+		} while ($execCount < $bytes);
83 83
 
84
-        /**
85
-         * If we reach here, PHP has failed us.
86
-         */
87
-        throw new Exception(
88
-            'Could not gather sufficient random data'
89
-        );
90
-    }
84
+		/**
85
+		 * If we reach here, PHP has failed us.
86
+		 */
87
+		throw new Exception(
88
+			'Could not gather sufficient random data'
89
+		);
90
+	}
91 91
 }
92 92
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,7 +26,8 @@  discard block
 block discarded – undo
26 26
  * SOFTWARE.
27 27
  */
28 28
 
29
-if (!is_callable('random_bytes')) {
29
+if (!is_callable('random_bytes'))
30
+{
30 31
     /**
31 32
      * Windows with PHP < 5.3.0 will not have the function
32 33
      * openssl_random_pseudo_bytes() available, so let's use
@@ -40,16 +41,20 @@  discard block
 block discarded – undo
40 41
      */
41 42
     function random_bytes($bytes)
42 43
     {
43
-        try {
44
+        try
45
+        {
44 46
             /** @var int $bytes */
45 47
             $bytes = RandomCompat_intval($bytes);
46
-        } catch (TypeError $ex) {
48
+        }
49
+        catch (TypeError $ex)
50
+        {
47 51
             throw new TypeError(
48 52
                 'random_bytes(): $bytes must be an integer'
49 53
             );
50 54
         }
51 55
 
52
-        if ($bytes < 1) {
56
+        if ($bytes < 1)
57
+        {
53 58
             throw new Error(
54 59
                 'Length must be greater than 0'
55 60
             );
@@ -57,7 +62,8 @@  discard block
 block discarded – undo
57 62
 
58 63
         /** @var string $buf */
59 64
         $buf = '';
60
-        if (!class_exists('COM')) {
65
+        if (!class_exists('COM'))
66
+        {
61 67
             throw new Error(
62 68
                 'COM does not exist'
63 69
             );
@@ -72,7 +78,8 @@  discard block
 block discarded – undo
72 78
          */
73 79
         do {
74 80
             $buf .= base64_decode((string) $util->GetRandom($bytes, 0));
75
-            if (RandomCompat_strlen($buf) >= $bytes) {
81
+            if (RandomCompat_strlen($buf) >= $bytes)
82
+            {
76 83
                 /**
77 84
                  * Return our random entropy buffer here:
78 85
                  */
Please login to merge, or discard this patch.
Sources/random_compat/random_bytes_libsodium_legacy.php 2 patches
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -27,67 +27,67 @@
 block discarded – undo
27 27
  */
28 28
 
29 29
 if (!is_callable('random_bytes')) {
30
-    /**
31
-     * If the libsodium PHP extension is loaded, we'll use it above any other
32
-     * solution.
33
-     *
34
-     * libsodium-php project:
35
-     * @ref https://github.com/jedisct1/libsodium-php
36
-     *
37
-     * @param int $bytes
38
-     *
39
-     * @throws Exception
40
-     *
41
-     * @return string
42
-     */
43
-    function random_bytes($bytes)
44
-    {
45
-        try {
46
-            /** @var int $bytes */
47
-            $bytes = RandomCompat_intval($bytes);
48
-        } catch (TypeError $ex) {
49
-            throw new TypeError(
50
-                'random_bytes(): $bytes must be an integer'
51
-            );
52
-        }
30
+	/**
31
+	 * If the libsodium PHP extension is loaded, we'll use it above any other
32
+	 * solution.
33
+	 *
34
+	 * libsodium-php project:
35
+	 * @ref https://github.com/jedisct1/libsodium-php
36
+	 *
37
+	 * @param int $bytes
38
+	 *
39
+	 * @throws Exception
40
+	 *
41
+	 * @return string
42
+	 */
43
+	function random_bytes($bytes)
44
+	{
45
+		try {
46
+			/** @var int $bytes */
47
+			$bytes = RandomCompat_intval($bytes);
48
+		} catch (TypeError $ex) {
49
+			throw new TypeError(
50
+				'random_bytes(): $bytes must be an integer'
51
+			);
52
+		}
53 53
 
54
-        if ($bytes < 1) {
55
-            throw new Error(
56
-                'Length must be greater than 0'
57
-            );
58
-        }
54
+		if ($bytes < 1) {
55
+			throw new Error(
56
+				'Length must be greater than 0'
57
+			);
58
+		}
59 59
 
60
-        /**
61
-         * @var string
62
-         */
63
-        $buf = '';
60
+		/**
61
+		 * @var string
62
+		 */
63
+		$buf = '';
64 64
 
65
-        /**
66
-         * \Sodium\randombytes_buf() doesn't allow more than 2147483647 bytes to be
67
-         * generated in one invocation.
68
-         */
69
-        if ($bytes > 2147483647) {
70
-            for ($i = 0; $i < $bytes; $i += 1073741824) {
71
-                $n = ($bytes - $i) > 1073741824
72
-                    ? 1073741824
73
-                    : $bytes - $i;
74
-                $buf .= Sodium::randombytes_buf((int) $n);
75
-            }
76
-        } else {
77
-            $buf .= Sodium::randombytes_buf((int) $bytes);
78
-        }
65
+		/**
66
+		 * \Sodium\randombytes_buf() doesn't allow more than 2147483647 bytes to be
67
+		 * generated in one invocation.
68
+		 */
69
+		if ($bytes > 2147483647) {
70
+			for ($i = 0; $i < $bytes; $i += 1073741824) {
71
+				$n = ($bytes - $i) > 1073741824
72
+					? 1073741824
73
+					: $bytes - $i;
74
+				$buf .= Sodium::randombytes_buf((int) $n);
75
+			}
76
+		} else {
77
+			$buf .= Sodium::randombytes_buf((int) $bytes);
78
+		}
79 79
 
80
-        if (is_string($buf)) {
81
-            if (RandomCompat_strlen($buf) === $bytes) {
82
-                return $buf;
83
-            }
84
-        }
80
+		if (is_string($buf)) {
81
+			if (RandomCompat_strlen($buf) === $bytes) {
82
+				return $buf;
83
+			}
84
+		}
85 85
 
86
-        /**
87
-         * If we reach here, PHP has failed us.
88
-         */
89
-        throw new Exception(
90
-            'Could not gather sufficient random data'
91
-        );
92
-    }
86
+		/**
87
+		 * If we reach here, PHP has failed us.
88
+		 */
89
+		throw new Exception(
90
+			'Could not gather sufficient random data'
91
+		);
92
+	}
93 93
 }
Please login to merge, or discard this patch.
Braces   +20 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,7 +26,8 @@  discard block
 block discarded – undo
26 26
  * SOFTWARE.
27 27
  */
28 28
 
29
-if (!is_callable('random_bytes')) {
29
+if (!is_callable('random_bytes'))
30
+{
30 31
     /**
31 32
      * If the libsodium PHP extension is loaded, we'll use it above any other
32 33
      * solution.
@@ -42,16 +43,20 @@  discard block
 block discarded – undo
42 43
      */
43 44
     function random_bytes($bytes)
44 45
     {
45
-        try {
46
+        try
47
+        {
46 48
             /** @var int $bytes */
47 49
             $bytes = RandomCompat_intval($bytes);
48
-        } catch (TypeError $ex) {
50
+        }
51
+        catch (TypeError $ex)
52
+        {
49 53
             throw new TypeError(
50 54
                 'random_bytes(): $bytes must be an integer'
51 55
             );
52 56
         }
53 57
 
54
-        if ($bytes < 1) {
58
+        if ($bytes < 1)
59
+        {
55 60
             throw new Error(
56 61
                 'Length must be greater than 0'
57 62
             );
@@ -66,19 +71,25 @@  discard block
 block discarded – undo
66 71
          * \Sodium\randombytes_buf() doesn't allow more than 2147483647 bytes to be
67 72
          * generated in one invocation.
68 73
          */
69
-        if ($bytes > 2147483647) {
70
-            for ($i = 0; $i < $bytes; $i += 1073741824) {
74
+        if ($bytes > 2147483647)
75
+        {
76
+            for ($i = 0; $i < $bytes; $i += 1073741824)
77
+            {
71 78
                 $n = ($bytes - $i) > 1073741824
72 79
                     ? 1073741824
73 80
                     : $bytes - $i;
74 81
                 $buf .= Sodium::randombytes_buf((int) $n);
75 82
             }
76
-        } else {
83
+        }
84
+        else
85
+        {
77 86
             $buf .= Sodium::randombytes_buf((int) $bytes);
78 87
         }
79 88
 
80
-        if (is_string($buf)) {
81
-            if (RandomCompat_strlen($buf) === $bytes) {
89
+        if (is_string($buf))
90
+        {
91
+            if (RandomCompat_strlen($buf) === $bytes)
92
+            {
82 93
                 return $buf;
83 94
             }
84 95
         }
Please login to merge, or discard this patch.