@@ -28,8 +28,8 @@ discard block |
||
| 28 | 28 | * @throws IncompatibleObjectState |
| 29 | 29 | */ |
| 30 | 30 | public static function randomInt( |
| 31 | - int|string|DecimalInterface $min, |
|
| 32 | - int|string|DecimalInterface $max, |
|
| 31 | + int | string | DecimalInterface $min, |
|
| 32 | + int | string | DecimalInterface $max, |
|
| 33 | 33 | #[ExpectedValues([self::MODE_ENTROPY, self::MODE_SPEED])] |
| 34 | 34 | int $mode = self::MODE_ENTROPY |
| 35 | 35 | ): ImmutableDecimal |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | throw new OptionalExit( |
| 107 | 107 | 'System error from random_bytes().', |
| 108 | 108 | 'Ensure your system is configured correctly.', |
| 109 | - 'A call to random_bytes() threw a system level exception. Most often this is due to a problem with entropy sources in your configuration. Original exception message: ' . $e->getMessage() |
|
| 109 | + 'A call to random_bytes() threw a system level exception. Most often this is due to a problem with entropy sources in your configuration. Original exception message: '.$e->getMessage() |
|
| 110 | 110 | ); |
| 111 | 111 | } |
| 112 | 112 | } elseif ($mode == self::MODE_SPEED) { |
@@ -148,14 +148,14 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | $entropyBytes = random_bytes($bytesNeeded->asInt()); |
| 150 | 150 | $baseTwoBytes = ''; |
| 151 | - for($i = 0; $i < strlen($entropyBytes); $i++){ |
|
| 152 | - $baseTwoBytes .= decbin( ord( $entropyBytes[$i] ) ); |
|
| 151 | + for ($i = 0; $i < strlen($entropyBytes); $i++) { |
|
| 152 | + $baseTwoBytes .= decbin(ord($entropyBytes[$i])); |
|
| 153 | 153 | } |
| 154 | 154 | } catch (Exception $e) { |
| 155 | 155 | throw new OptionalExit( |
| 156 | 156 | 'System error from random_bytes().', |
| 157 | 157 | 'Ensure your system is configured correctly.', |
| 158 | - 'A call to random_bytes() threw a system level exception. Most often this is due to a problem with entropy sources in your configuration. Original exception message: ' . $e->getMessage() |
|
| 158 | + 'A call to random_bytes() threw a system level exception. Most often this is due to a problem with entropy sources in your configuration. Original exception message: '.$e->getMessage() |
|
| 159 | 159 | ); |
| 160 | 160 | } |
| 161 | 161 | |
@@ -250,8 +250,8 @@ discard block |
||
| 250 | 250 | * @throws IncompatibleObjectState |
| 251 | 251 | */ |
| 252 | 252 | public static function randomReal( |
| 253 | - int|string|DecimalInterface $min, |
|
| 254 | - int|string|DecimalInterface $max, |
|
| 253 | + int | string | DecimalInterface $min, |
|
| 254 | + int | string | DecimalInterface $max, |
|
| 255 | 255 | int $scale, |
| 256 | 256 | #[ExpectedValues([self::MODE_ENTROPY, self::MODE_SPEED])] |
| 257 | 257 | int $mode = self::MODE_ENTROPY |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | * First we use string manipulation to extract the decimal portion as an integer value, the we right |
| 369 | 369 | * pad with zeroes to make sure that the entire scale is part of the valid result set. |
| 370 | 370 | */ |
| 371 | - $minDecimal = substr($min->getValue(), strpos($min->getValue(), '.') + 1); |
|
| 371 | + $minDecimal = substr($min->getValue(), strpos($min->getValue(), '.')+1); |
|
| 372 | 372 | $minDecimal = str_pad($minDecimal, $scale, '0', STR_PAD_RIGHT); |
| 373 | 373 | } |
| 374 | 374 | |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | * We cannot take advantage of a more efficient check for the top end of the range, so the |
| 378 | 378 | * less than check is all we need. |
| 379 | 379 | */ |
| 380 | - $maxDecimal = str_pad('1', $scale + 1, '0', STR_PAD_RIGHT); |
|
| 380 | + $maxDecimal = str_pad('1', $scale+1, '0', STR_PAD_RIGHT); |
|
| 381 | 381 | } else { |
| 382 | 382 | /** |
| 383 | 383 | * The max value is guaranteed to have a decimal portion here since we excluded max being |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | private string $left; |
| 14 | 14 | private string $right; |
| 15 | 15 | |
| 16 | - public function __construct(NumberInterface|ComponentInterface $left, NumberInterface|ComponentInterface $right) |
|
| 16 | + public function __construct(NumberInterface | ComponentInterface $left, NumberInterface | ComponentInterface $right) |
|
| 17 | 17 | { |
| 18 | 18 | |
| 19 | 19 | $this->left = ($left instanceof NumberInterface ? $left->getValue() : $left->getOutput()); |