Passed
Push — master ( 33ffaa...321396 )
by Joas
14:54 queued 12s
created
lib/private/Security/SecureRandom.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -39,28 +39,28 @@
 block discarded – undo
39 39
  * @package OC\Security
40 40
  */
41 41
 class SecureRandom implements ISecureRandom {
42
-	/**
43
-	 * Generate a secure random string of specified length.
44
-	 * @param int $length The length of the generated string
45
-	 * @param string $characters An optional list of characters to use if no character list is
46
-	 * 							specified all valid base64 characters are used.
47
-	 * @return string
48
-	 * @throws \LengthException if an invalid length is requested
49
-	 */
50
-	public function generate(int $length,
51
-							 string $characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'): string {
52
-		if ($length <= 0) {
53
-			throw new \LengthException('Invalid length specified: ' . $length . ' must be bigger than 0');
54
-		}
42
+    /**
43
+     * Generate a secure random string of specified length.
44
+     * @param int $length The length of the generated string
45
+     * @param string $characters An optional list of characters to use if no character list is
46
+     * 							specified all valid base64 characters are used.
47
+     * @return string
48
+     * @throws \LengthException if an invalid length is requested
49
+     */
50
+    public function generate(int $length,
51
+                                string $characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'): string {
52
+        if ($length <= 0) {
53
+            throw new \LengthException('Invalid length specified: ' . $length . ' must be bigger than 0');
54
+        }
55 55
 
56
-		$maxCharIndex = \strlen($characters) - 1;
57
-		$randomString = '';
56
+        $maxCharIndex = \strlen($characters) - 1;
57
+        $randomString = '';
58 58
 
59
-		while ($length > 0) {
60
-			$randomNumber = \random_int(0, $maxCharIndex);
61
-			$randomString .= $characters[$randomNumber];
62
-			$length--;
63
-		}
64
-		return $randomString;
65
-	}
59
+        while ($length > 0) {
60
+            $randomNumber = \random_int(0, $maxCharIndex);
61
+            $randomString .= $characters[$randomNumber];
62
+            $length--;
63
+        }
64
+        return $randomString;
65
+    }
66 66
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	public function generate(int $length,
51 51
 							 string $characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'): string {
52 52
 		if ($length <= 0) {
53
-			throw new \LengthException('Invalid length specified: ' . $length . ' must be bigger than 0');
53
+			throw new \LengthException('Invalid length specified: '.$length.' must be bigger than 0');
54 54
 		}
55 55
 
56 56
 		$maxCharIndex = \strlen($characters) - 1;
Please login to merge, or discard this patch.