Passed
Push — dev ( 6a4d5d...681eb3 )
by Jordan
01:03 queued 11s
created
src/Samsara/Fermat/Provider/Distribution/Base/Distribution.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
     {
19 19
         $sample = new NumberCollection();
20 20
 
21
-        for ($i = 1;$i < $sampleSize;$i++) {
21
+        for ($i = 1; $i < $sampleSize; $i++) {
22 22
             $sample->push($this->random());
23 23
         }
24 24
 
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,6 +25,6 @@
 block discarded – undo
25 25
         return $sample;
26 26
     }
27 27
 
28
-     abstract public function rangeRandom($min = 0, $max = PHP_INT_MAX, int $maxIterations = 20): ImmutableDecimal;
28
+        abstract public function rangeRandom($min = 0, $max = PHP_INT_MAX, int $maxIterations = 20): ImmutableDecimal;
29 29
 
30 30
 }
31 31
\ No newline at end of file
Please login to merge, or discard this patch.
src/Samsara/Fermat/Types/Traits/IntegerMathTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
         $curVal = $this->getValue();
34 34
         $calcVal = Numbers::make(Numbers::IMMUTABLE, 1);
35 35
 
36
-        for ($i = 1;$i <= $curVal;$i++) {
36
+        for ($i = 1; $i <= $curVal; $i++) {
37 37
             $calcVal = $calcVal->multiply($i);
38 38
         }
39 39
 
Please login to merge, or discard this patch.
src/Samsara/Fermat/Types/NumberCollection.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      */
145 145
     public function sort(): NumberCollectionInterface
146 146
     {
147
-        $this->getCollection()->sort(function($left, $right){
147
+        $this->getCollection()->sort(function($left, $right) {
148 148
             return ArithmeticProvider::compare($left->getAsBaseTenRealNumber(), $right->getAsBaseTenRealNumber());
149 149
         });
150 150
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
      */
278 278
     public function getRandom(): NumberInterface
279 279
     {
280
-        $maxKey = $this->getCollection()->count() - 1;
280
+        $maxKey = $this->getCollection()->count()-1;
281 281
 
282 282
         $key = PolyfillProvider::randomInt(0, $maxKey);
283 283
 
Please login to merge, or discard this patch.
src/Samsara/Fermat/Types/Traits/ComparisonTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -220,7 +220,7 @@
 block discarded – undo
220 220
 
221 221
         if ($check === 1) {
222 222
             $checkVal = $this->getDecimalPart();
223
-            $checkVal = trim($checkVal,'0');
223
+            $checkVal = trim($checkVal, '0');
224 224
 
225 225
             return !($checkVal !== '');
226 226
         }
Please login to merge, or discard this patch.
src/Samsara/Fermat/Provider/SequenceProvider.php 1 patch
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -14,57 +14,57 @@  discard block
 block discarded – undo
14 14
 {
15 15
 
16 16
     const EULER_ZIGZAG = [
17
-        '1',                                                        // 0
18
-        '1',                                                        // 1
19
-        '1',                                                        // 2
20
-        '2',                                                        // 3
21
-        '5',                                                        // 4
22
-        '16',                                                       // 5
23
-        '61',                                                       // 6
24
-        '272',                                                      // 7
25
-        '1385',                                                     // 8
26
-        '7936',                                                     // 9
27
-        '50521',                                                    // 10
28
-        '353792',                                                   // 11
29
-        '2702765',                                                  // 12
30
-        '22368256',                                                 // 13
31
-        '199360981',                                                // 14
32
-        '1903757312',                                               // 15
33
-        '19391512145',                                              // 16
34
-        '209865342976',                                             // 17
35
-        '2404879675441',                                            // 18
36
-        '29088885112832',                                           // 19
37
-        '370371188237525',                                          // 20
38
-        '4951498053124096',                                         // 21
39
-        '69348874393137901',                                        // 22
40
-        '1015423886506852352',                                      // 23
41
-        '15514534163557086905',                                     // 24
42
-        '246921480190207983616',                                    // 25
43
-        '4087072509293123892361',                                   // 26
44
-        '70251601603943959887872',                                  // 27
45
-        '1252259641403629865468285',                                // 28
46
-        '23119184187809597841473536',                               // 29
47
-        '441543893249023104553682821',                              // 30
48
-        '8713962757125169296170811392',                             // 31
49
-        '177519391579539289436664789665',                           // 32
50
-        '3729407703720529571097509625856',                          // 33
51
-        '80723299235887898062168247453281',                         // 34
52
-        '1798651693450888780071750349094912',                       // 35
53
-        '41222060339517702122347079671259045',                      // 36
54
-        '970982810785059112379399707952152576',                     // 37
55
-        '23489580527043108252017828576198947741',                   // 38
56
-        '583203324917310043943191641625494290432',                  // 39
57
-        '14851150718114980017877156781405826684425',                // 40
58
-        '387635983772083031828014624002175135645696',               // 41
59
-        '10364622733519612119397957304745185976310201',             // 42
60
-        '283727921907431909304183316295787837183229952',            // 43
61
-        '7947579422597592703608040510088070619519273805',           // 44
62
-        '227681379129930886488600284336316164603920777216',         // 45
63
-        '6667537516685544977435028474773748197524107684661',        // 46
64
-        '199500252157859031027160499643195658166340757225472',      // 47
65
-        '6096278645568542158691685742876843153976539044435185',     // 48
66
-        '190169564657928428175235445073924928592047775873499136',   // 49
67
-        '6053285248188621896314383785111649088103498225146815121',  // 50
17
+        '1', // 0
18
+        '1', // 1
19
+        '1', // 2
20
+        '2', // 3
21
+        '5', // 4
22
+        '16', // 5
23
+        '61', // 6
24
+        '272', // 7
25
+        '1385', // 8
26
+        '7936', // 9
27
+        '50521', // 10
28
+        '353792', // 11
29
+        '2702765', // 12
30
+        '22368256', // 13
31
+        '199360981', // 14
32
+        '1903757312', // 15
33
+        '19391512145', // 16
34
+        '209865342976', // 17
35
+        '2404879675441', // 18
36
+        '29088885112832', // 19
37
+        '370371188237525', // 20
38
+        '4951498053124096', // 21
39
+        '69348874393137901', // 22
40
+        '1015423886506852352', // 23
41
+        '15514534163557086905', // 24
42
+        '246921480190207983616', // 25
43
+        '4087072509293123892361', // 26
44
+        '70251601603943959887872', // 27
45
+        '1252259641403629865468285', // 28
46
+        '23119184187809597841473536', // 29
47
+        '441543893249023104553682821', // 30
48
+        '8713962757125169296170811392', // 31
49
+        '177519391579539289436664789665', // 32
50
+        '3729407703720529571097509625856', // 33
51
+        '80723299235887898062168247453281', // 34
52
+        '1798651693450888780071750349094912', // 35
53
+        '41222060339517702122347079671259045', // 36
54
+        '970982810785059112379399707952152576', // 37
55
+        '23489580527043108252017828576198947741', // 38
56
+        '583203324917310043943191641625494290432', // 39
57
+        '14851150718114980017877156781405826684425', // 40
58
+        '387635983772083031828014624002175135645696', // 41
59
+        '10364622733519612119397957304745185976310201', // 42
60
+        '283727921907431909304183316295787837183229952', // 43
61
+        '7947579422597592703608040510088070619519273805', // 44
62
+        '227681379129930886488600284336316164603920777216', // 45
63
+        '6667537516685544977435028474773748197524107684661', // 46
64
+        '199500252157859031027160499643195658166340757225472', // 47
65
+        '6096278645568542158691685742876843153976539044435185', // 48
66
+        '190169564657928428175235445073924928592047775873499136', // 49
67
+        '6053285248188621896314383785111649088103498225146815121', // 50
68 68
     ];
69 69
 
70 70
     /**
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
         if ($asCollection) {
83 83
             $sequence = new NumberCollection();
84 84
 
85
-            for ($i = 0;$i < $collectionSize;$i++) {
86
-                $sequence->push(self::nthOddNumber($n + $i));
85
+            for ($i = 0; $i < $collectionSize; $i++) {
86
+                $sequence->push(self::nthOddNumber($n+$i));
87 87
             }
88 88
 
89 89
             return $sequence;
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
         if ($asCollection) {
112 112
             $sequence = new NumberCollection();
113 113
 
114
-            for ($i = 0;$i < $collectionSize;$i++) {
115
-                $sequence->push(self::nthEvenNumber($n + $i));
114
+            for ($i = 0; $i < $collectionSize; $i++) {
115
+                $sequence->push(self::nthEvenNumber($n+$i));
116 116
             }
117 117
 
118 118
             return $sequence;
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
         if ($asCollection) {
141 141
             $sequence = new NumberCollection();
142 142
 
143
-            for ($i = 0;$i < $collectionSize;$i++) {
144
-                $sequence->push(self::nthPowerNegativeOne($n + $i));
143
+            for ($i = 0; $i < $collectionSize; $i++) {
144
+                $sequence->push(self::nthPowerNegativeOne($n+$i));
145 145
             }
146 146
 
147 147
             return $sequence;
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
         if ($asCollection) {
175 175
             $sequence = new NumberCollection();
176 176
 
177
-            for ($i = 0;$i < $collectionSize;$i++) {
178
-                $sequence->push(self::nthEulerZigzag($n + $i));
177
+            for ($i = 0; $i < $collectionSize; $i++) {
178
+                $sequence->push(self::nthEulerZigzag($n+$i));
179 179
             }
180 180
 
181 181
             return $sequence;
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
             $sequence = new NumberCollection();
263 263
             $sequence->push($fastFib[0]);
264 264
             $sequence->push($fastFib[1]);
265
-            for ($i = 0;$i < ($collectionSize-2);$i++) {
265
+            for ($i = 0; $i < ($collectionSize-2); $i++) {
266 266
                 $sequence->push($sequence->get($i)->add($sequence[$i+1]));
267 267
             }
268 268
 
Please login to merge, or discard this patch.
src/Samsara/Fermat/Provider/Distribution/Poisson.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
         $cumulative = Numbers::makeZero();
80 80
 
81
-        for ($i = 0;$x->isGreaterThanOrEqualTo($i);$i++) {
81
+        for ($i = 0; $x->isGreaterThanOrEqualTo($i); $i++) {
82 82
             $cumulative = $cumulative->add($this->pmf($i));
83 83
         }
84 84
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
         $cumulative = Numbers::makeZero();
147 147
 
148
-        for (;$larger->isGreaterThanOrEqualTo($smaller);$smaller->add(1)) {
148
+        for (;$larger->isGreaterThanOrEqualTo($smaller); $smaller->add(1)) {
149 149
             $cumulative = $cumulative->add($this->pmf($smaller));
150 150
         }
151 151
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
         while (true) {
229 229
             /** @var ImmutableDecimal $u */
230
-            $u = PolyfillProvider::randomInt(0, PHP_INT_MAX) / PHP_INT_MAX;
230
+            $u = PolyfillProvider::randomInt(0, PHP_INT_MAX)/PHP_INT_MAX;
231 231
             /** @var ImmutableDecimal $x */
232 232
             $x = $alpha->subtract($one->subtract($u)->divide($u)->ln(20)->divide($beta));
233 233
             /** @var ImmutableDecimal $n */
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
         do {
280 280
             $k = $k->add(1);
281 281
             /** @var ImmutableDecimal $u */
282
-            $u = PolyfillProvider::randomInt(0, PHP_INT_MAX) / PHP_INT_MAX;
282
+            $u = PolyfillProvider::randomInt(0, PHP_INT_MAX)/PHP_INT_MAX;
283 283
             $p = $p->multiply($u);
284 284
         } while ($p->isGreaterThan($L));
285 285
 
Please login to merge, or discard this patch.
src/Samsara/Fermat/Matrices.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
     {
18 18
         $matrixData = [];
19 19
 
20
-        for ($i = 0;$i < $rows;$i++) {
20
+        for ($i = 0; $i < $rows; $i++) {
21 21
             $matrixData[$i] = new NumberCollection();
22
-            for ($n = 0;$n < $columns;$n++) {
22
+            for ($n = 0; $n < $columns; $n++) {
23 23
                 $matrixData[$i]->push(Numbers::makeZero());
24 24
             }
25 25
         }
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
     {
32 32
         $matrixData = [];
33 33
 
34
-        for ($i = 0;$i < $rows;$i++) {
34
+        for ($i = 0; $i < $rows; $i++) {
35 35
             $matrixData[$i] = new NumberCollection();
36
-            for ($n = 0;$n < $columns;$n++) {
36
+            for ($n = 0; $n < $columns; $n++) {
37 37
                 $matrixData[$i]->push(Numbers::makeOne());
38 38
             }
39 39
         }
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
     {
46 46
         $matrixData = [];
47 47
 
48
-        for ($i = 0;$i < $size;$i++) {
48
+        for ($i = 0; $i < $size; $i++) {
49 49
             $matrixData[$i] = new NumberCollection();
50
-            for ($n = 0;$n < $size;$n++) {
50
+            for ($n = 0; $n < $size; $n++) {
51 51
                 if ($n === $i) {
52 52
                     $matrixData[$i]->push(Numbers::makeOne());
53 53
                 } else {
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
         $p = 0;
68 68
 
69
-        for ($i = 0;$i < $size;$i++) {
69
+        for ($i = 0; $i < $size; $i++) {
70 70
             $matrixData[$i] = SequenceProvider::nthPowerNegativeOne($p, true, $size);
71 71
             $p = ($p === 0 ? 1 : 0);
72 72
         }
Please login to merge, or discard this patch.
src/Samsara/Fermat/Values/Algebra/PolynomialFunction.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
      */
173 173
     public static function createFromFoil(array $group1, array $group2): PolynomialFunction
174 174
     {
175
-        $group1exp = count($group1) - 1;
176
-        $group2exp = count($group2) - 1;
175
+        $group1exp = count($group1)-1;
176
+        $group2exp = count($group2)-1;
177 177
 
178 178
         /** @var ImmutableDecimal[] $finalCoefs */
179 179
         $finalCoefs = [];
@@ -198,16 +198,16 @@  discard block
 block discarded – undo
198 198
          * @var ImmutableDecimal $value1
199 199
          */
200 200
         foreach ($largerGroup as $key1 => $value1) {
201
-            $largerKey = $largerExp - $key1;
201
+            $largerKey = $largerExp-$key1;
202 202
 
203 203
             /**
204 204
              * @var int             $key2
205 205
              * @var ImmutableDecimal $value2
206 206
              */
207 207
             foreach ($smallerGroup as $key2 => $value2) {
208
-                $smallerKey = $smallerExp - $key2;
208
+                $smallerKey = $smallerExp-$key2;
209 209
                 $newVal = $value1->multiply($value2);
210
-                $newExp = $largerKey + $smallerKey;
210
+                $newExp = $largerKey+$smallerKey;
211 211
 
212 212
                 if (isset($finalCoefs[$newExp])) {
213 213
                     $finalCoefs[$newExp] = $finalCoefs[$newExp]->add($newVal);
Please login to merge, or discard this patch.
src/Samsara/Fermat/Types/Traits/Arithmetic/ArithmeticPrecisionTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
         if (!$num->isWhole()) {
71 71
             $precision += 5;
72 72
             $exponent = $num->multiply($this->ln($precision));
73
-            return $exponent->exp($precision)->truncateToPrecision($precision - 5)->getValue();
73
+            return $exponent->exp($precision)->truncateToPrecision($precision-5)->getValue();
74 74
         }
75 75
 
76 76
         return ArithmeticProvider::pow($this->asReal(), $num->asReal(), $precision);
Please login to merge, or discard this patch.