@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * @param DecimalInterface $num |
16 | 16 | * @return int|float |
17 | 17 | */ |
18 | - protected static function translateToNative(DecimalInterface $num): int|float |
|
18 | + protected static function translateToNative(DecimalInterface $num): int | float |
|
19 | 19 | { |
20 | 20 | return ($num->isInt() ? $num->asInt() : $num->asFloat()); |
21 | 21 | } |
@@ -24,74 +24,74 @@ discard block |
||
24 | 24 | * @param DecimalInterface $num |
25 | 25 | * @return int|float |
26 | 26 | */ |
27 | - protected function addNative(DecimalInterface $num): int|float |
|
27 | + protected function addNative(DecimalInterface $num): int | float |
|
28 | 28 | { |
29 | 29 | $left = self::translateToNative($this); |
30 | 30 | $right = self::translateToNative($num); |
31 | 31 | |
32 | - $value = $left + $right; |
|
33 | - return (string)$value; |
|
32 | + $value = $left+$right; |
|
33 | + return (string) $value; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
37 | 37 | * @param DecimalInterface $num |
38 | 38 | * @return int|float |
39 | 39 | */ |
40 | - protected function subtractNative(DecimalInterface $num): int|float |
|
40 | + protected function subtractNative(DecimalInterface $num): int | float |
|
41 | 41 | { |
42 | 42 | $left = self::translateToNative($this); |
43 | 43 | $right = self::translateToNative($num); |
44 | 44 | |
45 | - $value = $left - $right; |
|
46 | - return (string)$value; |
|
45 | + $value = $left-$right; |
|
46 | + return (string) $value; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | 50 | * @param DecimalInterface $num |
51 | 51 | * @return int|float |
52 | 52 | */ |
53 | - protected function multiplyNative(DecimalInterface $num): int|float |
|
53 | + protected function multiplyNative(DecimalInterface $num): int | float |
|
54 | 54 | { |
55 | 55 | $left = self::translateToNative($this); |
56 | 56 | $right = self::translateToNative($num); |
57 | 57 | |
58 | - $value = $left * $right; |
|
59 | - return (string)$value; |
|
58 | + $value = $left*$right; |
|
59 | + return (string) $value; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | 63 | * @param DecimalInterface $num |
64 | 64 | * @return int|float |
65 | 65 | */ |
66 | - protected function divideNative(DecimalInterface $num): int|float |
|
66 | + protected function divideNative(DecimalInterface $num): int | float |
|
67 | 67 | { |
68 | 68 | $left = self::translateToNative($this); |
69 | 69 | $right = self::translateToNative($num); |
70 | 70 | |
71 | - $value = $left / $right; |
|
72 | - return (string)$value; |
|
71 | + $value = $left/$right; |
|
72 | + return (string) $value; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
76 | 76 | * @param DecimalInterface $num |
77 | 77 | * @return int|float |
78 | 78 | */ |
79 | - protected function powNative(DecimalInterface $num): int|float |
|
79 | + protected function powNative(DecimalInterface $num): int | float |
|
80 | 80 | { |
81 | 81 | $left = self::translateToNative($this); |
82 | 82 | $right = self::translateToNative($num); |
83 | 83 | |
84 | 84 | $value = pow($left, $right); |
85 | - return (string)$value; |
|
85 | + return (string) $value; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
89 | 89 | * @return int|float |
90 | 90 | */ |
91 | - protected function sqrtNative(): int|float |
|
91 | + protected function sqrtNative(): int | float |
|
92 | 92 | { |
93 | 93 | $value = sqrt($this->asFloat()); |
94 | - return (string)$value; |
|
94 | + return (string) $value; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | } |
98 | 98 | \ No newline at end of file |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function sort(): NumberCollectionInterface |
181 | 181 | { |
182 | - $this->getCollection()->sort(function($left, $right){ |
|
182 | + $this->getCollection()->sort(function($left, $right) { |
|
183 | 183 | return ArithmeticProvider::compare($left->getAsBaseTenRealNumber(), $right->getAsBaseTenRealNumber()); |
184 | 184 | }); |
185 | 185 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | */ |
313 | 313 | public function getRandom(): NumberInterface |
314 | 314 | { |
315 | - $maxKey = $this->getCollection()->count() - 1; |
|
315 | + $maxKey = $this->getCollection()->count()-1; |
|
316 | 316 | |
317 | 317 | $key = RandomProvider::randomInt(0, $maxKey, RandomMode::Speed)->asInt(); |
318 | 318 |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | $this->base = $base; |
50 | 50 | |
51 | - $value = $value instanceof NumberInterface ? $value->getValue(NumberBase::Ten) : (string)$value; |
|
51 | + $value = $value instanceof NumberInterface ? $value->getValue(NumberBase::Ten) : (string) $value; |
|
52 | 52 | |
53 | 53 | if (str_contains($value, 'i')) { |
54 | 54 | $this->imaginary = true; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $this->scale = ($scale > strlen($this->getDecimalPart())) ? $scale : strlen($this->getDecimalPart()); |
76 | 76 | } else { |
77 | 77 | $checkVal = $this->getDecimalPart(); |
78 | - $checkVal = trim($checkVal,'0'); |
|
78 | + $checkVal = trim($checkVal, '0'); |
|
79 | 79 | |
80 | 80 | if (strlen($checkVal) > 0) { |
81 | 81 | $this->scale = (strlen($this->getDecimalPart()) > 10) ? strlen($this->getDecimalPart()) : 10; |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | if ($exp > 0) { |
121 | 121 | $exp -= strlen($right); |
122 | 122 | if ($exp >= 0) { |
123 | - $right = str_pad($right, $exp - 1, '0').'.0'; |
|
123 | + $right = str_pad($right, $exp-1, '0').'.0'; |
|
124 | 124 | } else { |
125 | - $right = substr($right, 0, strlen($right) + $exp).'.'.substr($right, strlen($right) + $exp + 1); |
|
125 | + $right = substr($right, 0, strlen($right)+$exp).'.'.substr($right, strlen($right)+$exp+1); |
|
126 | 126 | } |
127 | 127 | } else { |
128 | 128 | $exp += strlen($left); |
129 | 129 | if ($exp >= 0) { |
130 | - $left = substr($left, 0, $exp).'.'.substr($left, $exp + 1); |
|
130 | + $left = substr($left, 0, $exp).'.'.substr($left, $exp+1); |
|
131 | 131 | } else { |
132 | 132 | $left = '0.'.str_pad($left, $exp, '0', STR_PAD_LEFT); |
133 | 133 | } |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * @param NumberBase $base |
278 | 278 | * @return DecimalInterface|NumberInterface |
279 | 279 | */ |
280 | - public function setBase(NumberBase $base): DecimalInterface|NumberInterface |
|
280 | + public function setBase(NumberBase $base): DecimalInterface | NumberInterface |
|
281 | 281 | { |
282 | 282 | $this->base = $base; |
283 | 283 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * |
290 | 290 | * @return DecimalInterface|NumberInterface |
291 | 291 | */ |
292 | - public function abs(): DecimalInterface|NumberInterface |
|
292 | + public function abs(): DecimalInterface | NumberInterface |
|
293 | 293 | { |
294 | 294 | $newValue = $this->absValue(); |
295 | 295 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * @param DecimalInterface $num |
301 | 301 | * @return float|int |
302 | 302 | */ |
303 | - protected static function translateToNative(DecimalInterface $num): float|int |
|
303 | + protected static function translateToNative(DecimalInterface $num): float | int |
|
304 | 304 | { |
305 | 305 | return ($num->isInt() ? $num->asInt() : $num->asFloat()); |
306 | 306 | } |
@@ -359,6 +359,6 @@ discard block |
||
359 | 359 | * @param NumberInterface|string|int|float $mod |
360 | 360 | * @return DecimalInterface |
361 | 361 | */ |
362 | - abstract public function continuousModulo(NumberInterface|string|int|float $mod): DecimalInterface; |
|
362 | + abstract public function continuousModulo(NumberInterface | string | int | float $mod): DecimalInterface; |
|
363 | 363 | |
364 | 364 | } |
365 | 365 | \ No newline at end of file |
@@ -23,7 +23,7 @@ |
||
23 | 23 | * @throws IntegrityConstraint |
24 | 24 | * @throws MissingPackage |
25 | 25 | */ |
26 | - public function continuousModulo(NumberInterface|string|int|float $mod): DecimalInterface |
|
26 | + public function continuousModulo(NumberInterface | string | int | float $mod): DecimalInterface |
|
27 | 27 | { |
28 | 28 | |
29 | 29 | if (is_object($mod) && method_exists($mod, 'getScale')) { |
@@ -21,7 +21,7 @@ |
||
21 | 21 | * @throws IntegrityConstraint |
22 | 22 | * @throws MissingPackage |
23 | 23 | */ |
24 | - public function continuousModulo(NumberInterface|string|int|float $mod): DecimalInterface |
|
24 | + public function continuousModulo(NumberInterface | string | int | float $mod): DecimalInterface |
|
25 | 25 | { |
26 | 26 | |
27 | 27 | $mod = Numbers::makeOrDont(Numbers::IMMUTABLE, $mod, $this->scale+1); |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | public static function radiansToDegrees($radians) |
22 | 22 | { |
23 | 23 | $radians = Numbers::makeOrDont(Numbers::IMMUTABLE, $radians); |
24 | - $pi = Numbers::makePi($radians->getScale() + 2); |
|
24 | + $pi = Numbers::makePi($radians->getScale()+2); |
|
25 | 25 | |
26 | - return $radians->multiply(180)->divide($pi, $radians->getScale() + 2)->round($radians->getScale() - 2)->getValue(NumberBase::Ten); |
|
26 | + return $radians->multiply(180)->divide($pi, $radians->getScale()+2)->round($radians->getScale()-2)->getValue(NumberBase::Ten); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | public static function degreesToRadians($degrees) |
36 | 36 | { |
37 | 37 | $degrees = Numbers::makeOrDont(Numbers::IMMUTABLE, $degrees); |
38 | - $pi = Numbers::makePi($degrees->getScale() + 1); |
|
38 | + $pi = Numbers::makePi($degrees->getScale()+1); |
|
39 | 39 | |
40 | 40 | return $degrees->multiply($pi)->divide(180)->round($degrees->getScale())->getValue(NumberBase::Ten); |
41 | 41 | } |
@@ -20,57 +20,57 @@ discard block |
||
20 | 20 | { |
21 | 21 | |
22 | 22 | const EULER_ZIGZAG = [ |
23 | - '1', // 0 |
|
24 | - '1', // 1 |
|
25 | - '1', // 2 |
|
26 | - '2', // 3 |
|
27 | - '5', // 4 |
|
28 | - '16', // 5 |
|
29 | - '61', // 6 |
|
30 | - '272', // 7 |
|
31 | - '1385', // 8 |
|
32 | - '7936', // 9 |
|
33 | - '50521', // 10 |
|
34 | - '353792', // 11 |
|
35 | - '2702765', // 12 |
|
36 | - '22368256', // 13 |
|
37 | - '199360981', // 14 |
|
38 | - '1903757312', // 15 |
|
39 | - '19391512145', // 16 |
|
40 | - '209865342976', // 17 |
|
41 | - '2404879675441', // 18 |
|
42 | - '29088885112832', // 19 |
|
43 | - '370371188237525', // 20 |
|
44 | - '4951498053124096', // 21 |
|
45 | - '69348874393137901', // 22 |
|
46 | - '1015423886506852352', // 23 |
|
47 | - '15514534163557086905', // 24 |
|
48 | - '246921480190207983616', // 25 |
|
49 | - '4087072509293123892361', // 26 |
|
50 | - '70251601603943959887872', // 27 |
|
51 | - '1252259641403629865468285', // 28 |
|
52 | - '23119184187809597841473536', // 29 |
|
53 | - '441543893249023104553682821', // 30 |
|
54 | - '8713962757125169296170811392', // 31 |
|
55 | - '177519391579539289436664789665', // 32 |
|
56 | - '3729407703720529571097509625856', // 33 |
|
57 | - '80723299235887898062168247453281', // 34 |
|
58 | - '1798651693450888780071750349094912', // 35 |
|
59 | - '41222060339517702122347079671259045', // 36 |
|
60 | - '970982810785059112379399707952152576', // 37 |
|
61 | - '23489580527043108252017828576198947741', // 38 |
|
62 | - '583203324917310043943191641625494290432', // 39 |
|
63 | - '14851150718114980017877156781405826684425', // 40 |
|
64 | - '387635983772083031828014624002175135645696', // 41 |
|
65 | - '10364622733519612119397957304745185976310201', // 42 |
|
66 | - '283727921907431909304183316295787837183229952', // 43 |
|
67 | - '7947579422597592703608040510088070619519273805', // 44 |
|
68 | - '227681379129930886488600284336316164603920777216', // 45 |
|
69 | - '6667537516685544977435028474773748197524107684661', // 46 |
|
70 | - '199500252157859031027160499643195658166340757225472', // 47 |
|
71 | - '6096278645568542158691685742876843153976539044435185', // 48 |
|
72 | - '190169564657928428175235445073924928592047775873499136', // 49 |
|
73 | - '6053285248188621896314383785111649088103498225146815121', // 50 |
|
23 | + '1', // 0 |
|
24 | + '1', // 1 |
|
25 | + '1', // 2 |
|
26 | + '2', // 3 |
|
27 | + '5', // 4 |
|
28 | + '16', // 5 |
|
29 | + '61', // 6 |
|
30 | + '272', // 7 |
|
31 | + '1385', // 8 |
|
32 | + '7936', // 9 |
|
33 | + '50521', // 10 |
|
34 | + '353792', // 11 |
|
35 | + '2702765', // 12 |
|
36 | + '22368256', // 13 |
|
37 | + '199360981', // 14 |
|
38 | + '1903757312', // 15 |
|
39 | + '19391512145', // 16 |
|
40 | + '209865342976', // 17 |
|
41 | + '2404879675441', // 18 |
|
42 | + '29088885112832', // 19 |
|
43 | + '370371188237525', // 20 |
|
44 | + '4951498053124096', // 21 |
|
45 | + '69348874393137901', // 22 |
|
46 | + '1015423886506852352', // 23 |
|
47 | + '15514534163557086905', // 24 |
|
48 | + '246921480190207983616', // 25 |
|
49 | + '4087072509293123892361', // 26 |
|
50 | + '70251601603943959887872', // 27 |
|
51 | + '1252259641403629865468285', // 28 |
|
52 | + '23119184187809597841473536', // 29 |
|
53 | + '441543893249023104553682821', // 30 |
|
54 | + '8713962757125169296170811392', // 31 |
|
55 | + '177519391579539289436664789665', // 32 |
|
56 | + '3729407703720529571097509625856', // 33 |
|
57 | + '80723299235887898062168247453281', // 34 |
|
58 | + '1798651693450888780071750349094912', // 35 |
|
59 | + '41222060339517702122347079671259045', // 36 |
|
60 | + '970982810785059112379399707952152576', // 37 |
|
61 | + '23489580527043108252017828576198947741', // 38 |
|
62 | + '583203324917310043943191641625494290432', // 39 |
|
63 | + '14851150718114980017877156781405826684425', // 40 |
|
64 | + '387635983772083031828014624002175135645696', // 41 |
|
65 | + '10364622733519612119397957304745185976310201', // 42 |
|
66 | + '283727921907431909304183316295787837183229952', // 43 |
|
67 | + '7947579422597592703608040510088070619519273805', // 44 |
|
68 | + '227681379129930886488600284336316164603920777216', // 45 |
|
69 | + '6667537516685544977435028474773748197524107684661', // 46 |
|
70 | + '199500252157859031027160499643195658166340757225472', // 47 |
|
71 | + '6096278645568542158691685742876843153976539044435185', // 48 |
|
72 | + '190169564657928428175235445073924928592047775873499136', // 49 |
|
73 | + '6053285248188621896314383785111649088103498225146815121', // 50 |
|
74 | 74 | ]; |
75 | 75 | |
76 | 76 | /** |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | if ($asCollection) { |
89 | 89 | $sequence = new NumberCollection(); |
90 | 90 | |
91 | - for ($i = 0;$i < $collectionSize;$i++) { |
|
92 | - $sequence->push(self::nthOddNumber($n + $i)); |
|
91 | + for ($i = 0; $i < $collectionSize; $i++) { |
|
92 | + $sequence->push(self::nthOddNumber($n+$i)); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | return $sequence; |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | if ($asCollection) { |
122 | 122 | $sequence = new NumberCollection(); |
123 | 123 | |
124 | - for ($i = 0;$i < $collectionSize;$i++) { |
|
125 | - $sequence->push(self::nthEvenNumber($n + $i)); |
|
124 | + for ($i = 0; $i < $collectionSize; $i++) { |
|
125 | + $sequence->push(self::nthEvenNumber($n+$i)); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | return $sequence; |
@@ -153,14 +153,14 @@ discard block |
||
153 | 153 | if ($asCollection) { |
154 | 154 | $sequence = new NumberCollection(); |
155 | 155 | |
156 | - for ($i = 0;$i < $collectionSize;$i++) { |
|
157 | - $sequence->push(self::nthPowerNegativeOne($n + $i)); |
|
156 | + for ($i = 0; $i < $collectionSize; $i++) { |
|
157 | + $sequence->push(self::nthPowerNegativeOne($n+$i)); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | return $sequence; |
161 | 161 | } |
162 | 162 | |
163 | - return ($n % 2 ? new ImmutableDecimal(-1) : new ImmutableDecimal(1)); |
|
163 | + return ($n%2 ? new ImmutableDecimal(-1) : new ImmutableDecimal(1)); |
|
164 | 164 | |
165 | 165 | } |
166 | 166 | |
@@ -180,8 +180,8 @@ discard block |
||
180 | 180 | if ($asCollection) { |
181 | 181 | $sequence = new NumberCollection(); |
182 | 182 | |
183 | - for ($i = 0;$i < $collectionSize;$i++) { |
|
184 | - $sequence->push(self::nthEulerZigzag($n + $i)); |
|
183 | + for ($i = 0; $i < $collectionSize; $i++) { |
|
184 | + $sequence->push(self::nthEulerZigzag($n+$i)); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | return $sequence; |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | $scale = $scale ?? 5; |
218 | 218 | |
219 | - $internalScale = (int)ceil($scale*(log10($scale)+1)); |
|
219 | + $internalScale = (int) ceil($scale*(log10($scale)+1)); |
|
220 | 220 | |
221 | 221 | $n = Numbers::makeOrDont(Numbers::IMMUTABLE, $n, $internalScale)->setMode(CalcMode::Precision); |
222 | 222 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | |
318 | 318 | $currentPrime = Numbers::make(Numbers::IMMUTABLE, 3); |
319 | 319 | |
320 | - for ($i = 1;$i < $n;$i++) { |
|
320 | + for ($i = 1; $i < $n; $i++) { |
|
321 | 321 | while (!$currentPrime->isPrime()) { |
322 | 322 | $currentPrime = $currentPrime->add(2); |
323 | 323 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | $sequence = new NumberCollection(); |
362 | 362 | $sequence->push($fastFib[0]); |
363 | 363 | $sequence->push($fastFib[1]); |
364 | - for ($i = 0;$i < ($collectionSize-2);$i++) { |
|
364 | + for ($i = 0; $i < ($collectionSize-2); $i++) { |
|
365 | 365 | $sequence->push($sequence->get($i)->add($sequence[$i+1])); |
366 | 366 | } |
367 | 367 |
@@ -75,16 +75,13 @@ discard block |
||
75 | 75 | if ($inputInt->isGreaterThan(0)) { |
76 | 76 | for ($pos = 0; $runningTotal->isLessThan($inputInt); $pos++) { |
77 | 77 | $basePow = $pos ? |
78 | - $baseNum->pow($pos) : |
|
79 | - $baseNum->pow($pos+1); |
|
78 | + $baseNum->pow($pos) : $baseNum->pow($pos+1); |
|
80 | 79 | $intPart = $pos ? $intPart : ''; |
81 | 80 | $mod = $pos ? |
82 | - (int)gmp_strval(gmp_div_q($inputInt->getAsBaseTenRealNumber(), $basePow->getAsBaseTenRealNumber())) : |
|
83 | - (int)gmp_strval(gmp_div_r($inputInt->getAsBaseTenRealNumber(), $basePow->getAsBaseTenRealNumber())); |
|
84 | - $intPart = self::$chars[$mod] . $intPart; |
|
81 | + (int) gmp_strval(gmp_div_q($inputInt->getAsBaseTenRealNumber(), $basePow->getAsBaseTenRealNumber())) : (int) gmp_strval(gmp_div_r($inputInt->getAsBaseTenRealNumber(), $basePow->getAsBaseTenRealNumber())); |
|
82 | + $intPart = self::$chars[$mod].$intPart; |
|
85 | 83 | $runningTotal = $pos ? |
86 | - $runningTotal->add($basePow->multiply($mod)) : |
|
87 | - $runningTotal->add($mod); |
|
84 | + $runningTotal->add($basePow->multiply($mod)) : $runningTotal->add($mod); |
|
88 | 85 | } |
89 | 86 | } |
90 | 87 | |
@@ -94,9 +91,8 @@ discard block |
||
94 | 91 | $basePow = $baseNum->pow($pos); |
95 | 92 | $decPart = $pos ? $decPart : ''; |
96 | 93 | $mod = $pos ? |
97 | - (int)gmp_strval(gmp_div_q($inputDec->getAsBaseTenRealNumber(), $baseNum->pow($pos)->getAsBaseTenRealNumber())) : |
|
98 | - $inputDec->modulo($baseNum->pow($pos))->asInt(); |
|
99 | - $decPart = self::$chars[$mod] . $decPart; |
|
94 | + (int) gmp_strval(gmp_div_q($inputDec->getAsBaseTenRealNumber(), $baseNum->pow($pos)->getAsBaseTenRealNumber())) : $inputDec->modulo($baseNum->pow($pos))->asInt(); |
|
95 | + $decPart = self::$chars[$mod].$decPart; |
|
100 | 96 | $runningTotal = $runningTotal->add($basePow->multiply($mod)); |
101 | 97 | } |
102 | 98 | } |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | * @throws IncompatibleObjectState |
31 | 31 | */ |
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 | RandomMode $mode = RandomMode::Entropy |
36 | 36 | ): ImmutableDecimal |
37 | 37 | { |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | throw new OptionalExit( |
108 | 108 | 'System error from random_bytes().', |
109 | 109 | 'Ensure your system is configured correctly.', |
110 | - '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 | + '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 | 111 | ); |
112 | 112 | } |
113 | 113 | } elseif ($mode == RandomMode::Speed) { |
@@ -147,14 +147,14 @@ discard block |
||
147 | 147 | */ |
148 | 148 | $entropyBytes = random_bytes($bytesNeeded->asInt()); |
149 | 149 | $baseTwoBytes = ''; |
150 | - for($i = 0; $i < strlen($entropyBytes); $i++){ |
|
151 | - $baseTwoBytes .= decbin( ord( $entropyBytes[$i] ) ); |
|
150 | + for ($i = 0; $i < strlen($entropyBytes); $i++) { |
|
151 | + $baseTwoBytes .= decbin(ord($entropyBytes[$i])); |
|
152 | 152 | } |
153 | 153 | } catch (Exception $e) { |
154 | 154 | throw new OptionalExit( |
155 | 155 | 'System error from random_bytes().', |
156 | 156 | 'Ensure your system is configured correctly.', |
157 | - '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() |
|
157 | + '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 | 158 | ); |
159 | 159 | } |
160 | 160 | |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | * @throws IncompatibleObjectState |
244 | 244 | */ |
245 | 245 | public static function randomReal( |
246 | - int|string|DecimalInterface $min, |
|
247 | - int|string|DecimalInterface $max, |
|
246 | + int | string | DecimalInterface $min, |
|
247 | + int | string | DecimalInterface $max, |
|
248 | 248 | int $scale, |
249 | 249 | RandomMode $mode = RandomMode::Entropy |
250 | 250 | ): ImmutableDecimal |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | * We cannot take advantage of a more efficient check for the top end of the range, so the |
370 | 370 | * less than check is all we need. |
371 | 371 | */ |
372 | - $maxDecimal = str_pad('1', $scale + 1, '0'); |
|
372 | + $maxDecimal = str_pad('1', $scale+1, '0'); |
|
373 | 373 | } else { |
374 | 374 | /** |
375 | 375 | * The max value is guaranteed to have a decimal portion here since we excluded max being |