@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public function sort(): NumberCollectionInterface |
| 162 | 162 | { |
| 163 | - $this->getCollection()->sort(function($left, $right){ |
|
| 163 | + $this->getCollection()->sort(function($left, $right) { |
|
| 164 | 164 | return ArithmeticProvider::compare($left->getAsBaseTenRealNumber(), $right->getAsBaseTenRealNumber()); |
| 165 | 165 | }); |
| 166 | 166 | |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | */ |
| 294 | 294 | public function getRandom(): NumberInterface |
| 295 | 295 | { |
| 296 | - $maxKey = $this->getCollection()->count() - 1; |
|
| 296 | + $maxKey = $this->getCollection()->count()-1; |
|
| 297 | 297 | |
| 298 | 298 | $key = RandomProvider::randomInt(0, $maxKey, RandomProvider::MODE_SPEED)->asInt(); |
| 299 | 299 | |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | #[Pure] |
| 32 | 32 | public static function randomInt( |
| 33 | - int|string|DecimalInterface $min, |
|
| 34 | - int|string|DecimalInterface $max, |
|
| 33 | + int | string | DecimalInterface $min, |
|
| 34 | + int | string | DecimalInterface $max, |
|
| 35 | 35 | #[ExpectedValues([self::MODE_ENTROPY, self::MODE_SPEED])] |
| 36 | 36 | int $mode = self::MODE_ENTROPY |
| 37 | 37 | ): ImmutableDecimal |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | throw new OptionalExit( |
| 109 | 109 | 'System error from random_bytes().', |
| 110 | 110 | 'Ensure your system is configured correctly.', |
| 111 | - '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() |
|
| 111 | + '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() |
|
| 112 | 112 | ); |
| 113 | 113 | } |
| 114 | 114 | } elseif ($mode == self::MODE_SPEED) { |
@@ -150,14 +150,14 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | $entropyBytes = random_bytes($bytesNeeded->asInt()); |
| 152 | 152 | $baseTwoBytes = ''; |
| 153 | - for($i = 0; $i < strlen($entropyBytes); $i++){ |
|
| 154 | - $baseTwoBytes .= decbin( ord( $entropyBytes[$i] ) ); |
|
| 153 | + for ($i = 0; $i < strlen($entropyBytes); $i++) { |
|
| 154 | + $baseTwoBytes .= decbin(ord($entropyBytes[$i])); |
|
| 155 | 155 | } |
| 156 | 156 | } catch (Exception $e) { |
| 157 | 157 | throw new OptionalExit( |
| 158 | 158 | 'System error from random_bytes().', |
| 159 | 159 | 'Ensure your system is configured correctly.', |
| 160 | - '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() |
|
| 160 | + '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() |
|
| 161 | 161 | ); |
| 162 | 162 | } |
| 163 | 163 | |
@@ -254,8 +254,8 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | #[Pure] |
| 256 | 256 | public static function randomReal( |
| 257 | - int|string|DecimalInterface $min, |
|
| 258 | - int|string|DecimalInterface $max, |
|
| 257 | + int | string | DecimalInterface $min, |
|
| 258 | + int | string | DecimalInterface $max, |
|
| 259 | 259 | int $scale, |
| 260 | 260 | #[ExpectedValues([self::MODE_ENTROPY, self::MODE_SPEED])] |
| 261 | 261 | int $mode = self::MODE_ENTROPY |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | * First we use string manipulation to extract the decimal portion as an integer value, the we right |
| 373 | 373 | * pad with zeroes to make sure that the entire scale is part of the valid result set. |
| 374 | 374 | */ |
| 375 | - $minDecimal = substr($min->getValue(), strpos($min->getValue(), '.') + 1); |
|
| 375 | + $minDecimal = substr($min->getValue(), strpos($min->getValue(), '.')+1); |
|
| 376 | 376 | $minDecimal = str_pad($minDecimal, $scale, '0', STR_PAD_RIGHT); |
| 377 | 377 | } |
| 378 | 378 | |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | * We cannot take advantage of a more efficient check for the top end of the range, so the |
| 382 | 382 | * less than check is all we need. |
| 383 | 383 | */ |
| 384 | - $maxDecimal = str_pad('1', $scale + 1, '0', STR_PAD_RIGHT); |
|
| 384 | + $maxDecimal = str_pad('1', $scale+1, '0', STR_PAD_RIGHT); |
|
| 385 | 385 | } else { |
| 386 | 386 | /** |
| 387 | 387 | * The max value is guaranteed to have a decimal portion here since we excluded max being |