Completed
Push — master ( 5d186e...d62f94 )
by Jordan
16s queued 13s
created
src/Samsara/Fermat/Core/Types/NumberCollection.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Samsara/Fermat/Core/Types/Decimal.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -106,14 +106,14 @@  discard block
 block discarded – undo
106 106
                 if ($exp > 0) {
107 107
                     $exp -= strlen($right);
108 108
                     if ($exp >= 0) {
109
-                        $right = str_pad($right, $exp - 1, '0').'.0';
109
+                        $right = str_pad($right, $exp-1, '0').'.0';
110 110
                     } else {
111
-                        $right = substr($right, 0, strlen($right) + abs($exp)).'.'.substr($right, strlen($right) + abs($exp) + 1);
111
+                        $right = substr($right, 0, strlen($right)+abs($exp)).'.'.substr($right, strlen($right)+abs($exp)+1);
112 112
                     }
113 113
                 } else {
114 114
                     $exp += strlen($left);
115 115
                     if ($exp >= 0) {
116
-                        $left = substr($left, 0, $exp).'.'.substr($left, $exp + 1);
116
+                        $left = substr($left, 0, $exp).'.'.substr($left, $exp+1);
117 117
                     } else {
118 118
                         $left = '0.'.str_pad($left, abs($exp)+1, '0', STR_PAD_LEFT);
119 119
                     }
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      * @param NumberBase $base
259 259
      * @return DecimalInterface|NumberInterface
260 260
      */
261
-    public function setBase(NumberBase $base): DecimalInterface|NumberInterface
261
+    public function setBase(NumberBase $base): DecimalInterface | NumberInterface
262 262
     {
263 263
         $this->base = $base;
264 264
 
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
      *
271 271
      * @return DecimalInterface|NumberInterface
272 272
      */
273
-    public function abs(): DecimalInterface|NumberInterface
273
+    public function abs(): DecimalInterface | NumberInterface
274 274
     {
275 275
         $newValue = $this->absValue();
276 276
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
      * @param DecimalInterface $num
282 282
      * @return float|int
283 283
      */
284
-    protected static function translateToNative(DecimalInterface $num): float|int
284
+    protected static function translateToNative(DecimalInterface $num): float | int
285 285
     {
286 286
         return ($num->isInt() ? $num->asInt() : $num->asFloat());
287 287
     }
@@ -334,13 +334,13 @@  discard block
 block discarded – undo
334 334
      * @param bool $setToNewBase
335 335
      * @return DecimalInterface
336 336
      */
337
-    abstract protected function setValue(string $value, ?int $scale = null, ?NumberBase $base = null, bool $setToNewBase = false): DecimalInterface; // TODO: Check usages for base correctness & preservation
337
+    abstract protected function setValue(string $value, ?int $scale = null, ?NumberBase $base = null, bool $setToNewBase = false): DecimalInterface;// TODO: Check usages for base correctness & preservation
338 338
 
339 339
     /**
340 340
      * @param NumberInterface|string|int|float $mod
341 341
      * @return DecimalInterface
342 342
      */
343
-    abstract public function continuousModulo(NumberInterface|string|int|float $mod): DecimalInterface;
343
+    abstract public function continuousModulo(NumberInterface | string | int | float $mod): DecimalInterface;
344 344
 
345 345
     /**
346 346
      * @param string $decimalPart
Please login to merge, or discard this patch.
src/Samsara/Fermat/Core/Values/ImmutableDecimal.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
      * @throws IntegrityConstraint
25 25
      * @throws MissingPackage
26 26
      */
27
-    public function continuousModulo(NumberInterface|string|int|float $mod): DecimalInterface
27
+    public function continuousModulo(NumberInterface | string | int | float $mod): DecimalInterface
28 28
     {
29 29
 
30 30
         $mod = Numbers::makeOrDont(Numbers::IMMUTABLE, $mod);
Please login to merge, or discard this patch.
src/Samsara/Fermat/Core/Values/MutableDecimal.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/Samsara/Fermat/Core/Provider/TrigonometryProvider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Samsara/Fermat/Core/Provider/SequenceProvider.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -20,57 +20,57 @@  discard block
 block discarded – undo
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
     /**
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
      * @throws IntegrityConstraint
85 85
      * @throws MissingPackage
86 86
      */
87
-    public static function nthOddNumber(int $n, bool $asCollection = false, int $collectionSize = 10): ImmutableDecimal|NumberCollection
87
+    public static function nthOddNumber(int $n, bool $asCollection = false, int $collectionSize = 10): ImmutableDecimal | NumberCollection
88 88
     {
89 89
         if ($asCollection) {
90 90
             $sequence = new NumberCollection();
91 91
 
92 92
             for ($i = 0;$i < $collectionSize;$i++) {
93
-                $sequence->push(self::nthOddNumber($n + $i));
93
+                $sequence->push(self::nthOddNumber($n+$i));
94 94
             }
95 95
 
96 96
             return $sequence;
@@ -117,14 +117,14 @@  discard block
 block discarded – undo
117 117
      * @return ImmutableDecimal|NumberCollection
118 118
      * @throws IntegrityConstraint
119 119
      */
120
-    public static function nthEvenNumber(int $n, int $scale = null, bool $asCollection = false, int $collectionSize = 10): ImmutableDecimal|NumberCollection
120
+    public static function nthEvenNumber(int $n, int $scale = null, bool $asCollection = false, int $collectionSize = 10): ImmutableDecimal | NumberCollection
121 121
     {
122 122
 
123 123
         if ($asCollection) {
124 124
             $sequence = new NumberCollection();
125 125
 
126 126
             for ($i = 0;$i < $collectionSize;$i++) {
127
-                $sequence->push(self::nthEvenNumber($n + $i));
127
+                $sequence->push(self::nthEvenNumber($n+$i));
128 128
             }
129 129
 
130 130
             return $sequence;
@@ -149,20 +149,20 @@  discard block
 block discarded – undo
149 149
      * @return ImmutableDecimal|NumberCollection
150 150
      * @throws IntegrityConstraint
151 151
      */
152
-    public static function nthPowerNegativeOne(int $n, bool $asCollection = false, int $collectionSize = 10): ImmutableDecimal|NumberCollection
152
+    public static function nthPowerNegativeOne(int $n, bool $asCollection = false, int $collectionSize = 10): ImmutableDecimal | NumberCollection
153 153
     {
154 154
 
155 155
         if ($asCollection) {
156 156
             $sequence = new NumberCollection();
157 157
 
158 158
             for ($i = 0;$i < $collectionSize;$i++) {
159
-                $sequence->push(self::nthPowerNegativeOne($n + $i));
159
+                $sequence->push(self::nthPowerNegativeOne($n+$i));
160 160
             }
161 161
 
162 162
             return $sequence;
163 163
         }
164 164
 
165
-        return ($n % 2 ? new ImmutableDecimal(-1) : new ImmutableDecimal(1));
165
+        return ($n%2 ? new ImmutableDecimal(-1) : new ImmutableDecimal(1));
166 166
 
167 167
     }
168 168
 
@@ -176,14 +176,14 @@  discard block
 block discarded – undo
176 176
      * @return ImmutableDecimal|NumberCollection
177 177
      * @throws IntegrityConstraint
178 178
      */
179
-    public static function nthEulerZigzag(int $n, bool $asCollection = false, int $collectionSize = 10): ImmutableDecimal|NumberCollection
179
+    public static function nthEulerZigzag(int $n, bool $asCollection = false, int $collectionSize = 10): ImmutableDecimal | NumberCollection
180 180
     {
181 181
 
182 182
         if ($asCollection) {
183 183
             $sequence = new NumberCollection();
184 184
 
185 185
             for ($i = 0;$i < $collectionSize;$i++) {
186
-                $sequence->push(self::nthEulerZigzag($n + $i));
186
+                $sequence->push(self::nthEulerZigzag($n+$i));
187 187
             }
188 188
 
189 189
             return $sequence;
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
      * @return ImmutableDecimal|NumberCollection
346 346
      * @throws IntegrityConstraint
347 347
      */
348
-    public static function nthFibonacciNumber(int $n, bool $asCollection = false, int $collectionSize = 10): ImmutableDecimal|NumberCollection
348
+    public static function nthFibonacciNumber(int $n, bool $asCollection = false, int $collectionSize = 10): ImmutableDecimal | NumberCollection
349 349
     {
350 350
         $n = Numbers::makeOrDont(Numbers::IMMUTABLE, $n);
351 351
 
Please login to merge, or discard this patch.
src/Samsara/Fermat/Core/Provider/BaseConversionProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@
 block discarded – undo
106 106
             while ($runningTotal->isGreaterThan(0)) {
107 107
                 $current = gmp_div_qr($runningTotal->getAsBaseTenRealNumber(), $baseNum->getAsBaseTenRealNumber());
108 108
                 $mod = (int)$current[1];
109
-                $stringVal = self::$chars[$mod] . $stringVal;
109
+                $stringVal = self::$chars[$mod].$stringVal;
110 110
                 $runningTotal = Numbers::make(Numbers::IMMUTABLE, $current[0]);
111 111
             }
112 112
         } else {
Please login to merge, or discard this patch.
Fermat/Core/Provider/RoundingModeAdapters/Modes/StochasticAdapter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
             $remainder = substr($remainder, 0, 3);
27 27
             $target = (int)($digit.$remainder);
28 28
             $rangeMin = 0;
29
-            $rangeMax = (int)str_repeat('9', strlen($remainder) + 1);
29
+            $rangeMax = (int)str_repeat('9', strlen($remainder)+1);
30 30
         }
31 31
 
32 32
         $random = RandomProvider::randomInt($rangeMin, $rangeMax, RandomMode::Speed)->asInt();
Please login to merge, or discard this patch.
Samsara/Fermat/Core/Provider/RoundingModeAdapters/Modes/HalfOddAdapter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
         $remainder = $this->remainderCheck();
18 18
 
19 19
         if ($early == 0) {
20
-            return ($nextDigit % 2 == 1 && !$remainder) ? 0 : 1;
20
+            return ($nextDigit%2 == 1 && !$remainder) ? 0 : 1;
21 21
         } else {
22 22
             return $early == 1 ? 1 : 0;
23 23
         }
Please login to merge, or discard this patch.