@@ -44,8 +44,7 @@ |
||
| 44 | 44 | * |
| 45 | 45 | * @return string |
| 46 | 46 | */ |
| 47 | - function random_bytes($bytes) |
|
| 48 | - { |
|
| 47 | + function random_bytes($bytes) { |
|
| 49 | 48 | static $fp = null; |
| 50 | 49 | /** |
| 51 | 50 | * This block should only be run once |
@@ -38,8 +38,7 @@ |
||
| 38 | 38 | * |
| 39 | 39 | * @return int |
| 40 | 40 | */ |
| 41 | - function random_int($min, $max) |
|
| 42 | - { |
|
| 41 | + function random_int($min, $max) { |
|
| 43 | 42 | /** |
| 44 | 43 | * Type and input logic checks |
| 45 | 44 | * |
@@ -28,21 +28,18 @@ |
||
| 28 | 28 | |
| 29 | 29 | if (!class_exists('Error', false)) { |
| 30 | 30 | // We can't really avoid making this extend Exception in PHP 5. |
| 31 | - class Error extends Exception |
|
| 32 | - { |
|
| 31 | + class Error extends Exception { |
|
| 33 | 32 | |
| 34 | 33 | } |
| 35 | 34 | } |
| 36 | 35 | |
| 37 | 36 | if (!class_exists('TypeError', false)) { |
| 38 | 37 | if (is_subclass_of('Error', 'Exception')) { |
| 39 | - class TypeError extends Error |
|
| 40 | - { |
|
| 38 | + class TypeError extends Error { |
|
| 41 | 39 | |
| 42 | 40 | } |
| 43 | 41 | } else { |
| 44 | - class TypeError extends Exception |
|
| 45 | - { |
|
| 42 | + class TypeError extends Exception { |
|
| 46 | 43 | |
| 47 | 44 | } |
| 48 | 45 | } |
@@ -45,8 +45,7 @@ |
||
| 45 | 45 | * |
| 46 | 46 | * @throws TypeError |
| 47 | 47 | */ |
| 48 | - function RandomCompat_intval($number, $fail_open = false) |
|
| 49 | - { |
|
| 48 | + function RandomCompat_intval($number, $fail_open = false) { |
|
| 50 | 49 | if (is_int($number) || is_float($number)) { |
| 51 | 50 | $number += 0; |
| 52 | 51 | } elseif (is_numeric($number)) { |
@@ -207,8 +207,7 @@ |
||
| 207 | 207 | * @throws Exception |
| 208 | 208 | * @return string |
| 209 | 209 | */ |
| 210 | - function random_bytes($length) |
|
| 211 | - { |
|
| 210 | + function random_bytes($length) { |
|
| 212 | 211 | unset($length); // Suppress "variable not used" warnings. |
| 213 | 212 | throw new Exception( |
| 214 | 213 | 'There is no suitable CSPRNG installed on your system' |
@@ -43,8 +43,7 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @return int |
| 45 | 45 | */ |
| 46 | - function RandomCompat_strlen($binary_string) |
|
| 47 | - { |
|
| 46 | + function RandomCompat_strlen($binary_string) { |
|
| 48 | 47 | if (!is_string($binary_string)) { |
| 49 | 48 | throw new TypeError( |
| 50 | 49 | 'RandomCompat_strlen() expects a string' |
@@ -66,8 +65,7 @@ discard block |
||
| 66 | 65 | * |
| 67 | 66 | * @return int |
| 68 | 67 | */ |
| 69 | - function RandomCompat_strlen($binary_string) |
|
| 70 | - { |
|
| 68 | + function RandomCompat_strlen($binary_string) { |
|
| 71 | 69 | if (!is_string($binary_string)) { |
| 72 | 70 | throw new TypeError( |
| 73 | 71 | 'RandomCompat_strlen() expects a string' |
@@ -99,8 +97,7 @@ discard block |
||
| 99 | 97 | * |
| 100 | 98 | * @return string |
| 101 | 99 | */ |
| 102 | - function RandomCompat_substr($binary_string, $start, $length = null) |
|
| 103 | - { |
|
| 100 | + function RandomCompat_substr($binary_string, $start, $length = null) { |
|
| 104 | 101 | if (!is_string($binary_string)) { |
| 105 | 102 | throw new TypeError( |
| 106 | 103 | 'RandomCompat_substr(): First argument should be a string' |
@@ -151,8 +148,7 @@ discard block |
||
| 151 | 148 | * |
| 152 | 149 | * @return string |
| 153 | 150 | */ |
| 154 | - function RandomCompat_substr($binary_string, $start, $length = null) |
|
| 155 | - { |
|
| 151 | + function RandomCompat_substr($binary_string, $start, $length = null) { |
|
| 156 | 152 | if (!is_string($binary_string)) { |
| 157 | 153 | throw new TypeError( |
| 158 | 154 | 'RandomCompat_substr(): First argument should be a string' |
@@ -38,8 +38,7 @@ |
||
| 38 | 38 | * |
| 39 | 39 | * @return string |
| 40 | 40 | */ |
| 41 | - function random_bytes($bytes) |
|
| 42 | - { |
|
| 41 | + function random_bytes($bytes) { |
|
| 43 | 42 | try { |
| 44 | 43 | $bytes = RandomCompat_intval($bytes); |
| 45 | 44 | } catch (TypeError $ex) { |
@@ -38,8 +38,7 @@ |
||
| 38 | 38 | * |
| 39 | 39 | * @return string |
| 40 | 40 | */ |
| 41 | - function random_bytes($bytes) |
|
| 42 | - { |
|
| 41 | + function random_bytes($bytes) { |
|
| 43 | 42 | try { |
| 44 | 43 | $bytes = RandomCompat_intval($bytes); |
| 45 | 44 | } catch (TypeError $ex) { |
@@ -38,8 +38,7 @@ |
||
| 38 | 38 | * |
| 39 | 39 | * @return string |
| 40 | 40 | */ |
| 41 | - function random_bytes($bytes) |
|
| 42 | - { |
|
| 41 | + function random_bytes($bytes) { |
|
| 43 | 42 | try { |
| 44 | 43 | $bytes = RandomCompat_intval($bytes); |
| 45 | 44 | } catch (TypeError $ex) { |