Failed Conditions
Pull Request — dev (#50)
by Jordan
07:57
created
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.
src/Samsara/Fermat/Types/Traits/Arithmetic/ArithmeticNativeTrait.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
         $left = self::translateToNative($this);
37 37
         $right = self::translateToNative($num);
38 38
 
39
-        $value = $left + $right;
40
-        $value = (string)$value;
39
+        $value = $left+$right;
40
+        $value = (string) $value;
41 41
 
42 42
         return $value;
43 43
     }
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
         $left = self::translateToNative($this);
48 48
         $right = self::translateToNative($num);
49 49
 
50
-        $value = $left - $right;
51
-        $value = (string)$value;
50
+        $value = $left-$right;
51
+        $value = (string) $value;
52 52
 
53 53
         return $value;
54 54
     }
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
         $left = self::translateToNative($this);
59 59
         $right = self::translateToNative($num);
60 60
 
61
-        $value = $left * $right;
62
-        $value = (string)$value;
61
+        $value = $left*$right;
62
+        $value = (string) $value;
63 63
 
64 64
         return $value;
65 65
     }
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
         $left = self::translateToNative($this);
70 70
         $right = self::translateToNative($num);
71 71
 
72
-        $value = $left / $right;
73
-        $value = (string)$value;
72
+        $value = $left/$right;
73
+        $value = (string) $value;
74 74
 
75 75
         return $value;
76 76
     }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         $right = self::translateToNative($num);
82 82
 
83 83
         $value = pow($left, $right);
84
-        $value = (string)$value;
84
+        $value = (string) $value;
85 85
 
86 86
         return $value;
87 87
     }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     protected function sqrtNative()
90 90
     {
91 91
         $value = sqrt($this->asFloat());
92
-        $value = (string)$value;
92
+        $value = (string) $value;
93 93
 
94 94
         return $value;
95 95
     }
Please login to merge, or discard this patch.
src/Samsara/Fermat/Types/Traits/Decimal/TrigonometryTrait.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -28,15 +28,15 @@  discard block
 block discarded – undo
28 28
 
29 29
         $answer = SeriesProvider::maclaurinSeries(
30 30
             $modulo,
31
-            function ($n) {
31
+            function($n) {
32 32
                 $negOne = Numbers::make(Numbers::IMMUTABLE, -1, 100);
33 33
 
34 34
                 return $negOne->pow($n);
35 35
             },
36
-            function ($n) {
36
+            function($n) {
37 37
                 return SequenceProvider::nthOddNumber($n);
38 38
             },
39
-            function ($n) {
39
+            function($n) {
40 40
                 return SequenceProvider::nthOddNumber($n)->factorial();
41 41
             },
42 42
             0,
@@ -73,13 +73,13 @@  discard block
 block discarded – undo
73 73
 
74 74
         $answer = SeriesProvider::maclaurinSeries(
75 75
             $modulo,
76
-            function ($n) {
76
+            function($n) {
77 77
                 return SequenceProvider::nthPowerNegativeOne($n);
78 78
             },
79
-            function ($n) {
79
+            function($n) {
80 80
                 return SequenceProvider::nthEvenNumber($n);
81 81
             },
82
-            function ($n) {
82
+            function($n) {
83 83
                 return SequenceProvider::nthEvenNumber($n)->factorial();
84 84
             },
85 85
             0,
@@ -158,20 +158,20 @@  discard block
 block discarded – undo
158 158
         } else {
159 159
             $answer = SeriesProvider::maclaurinSeries(
160 160
                 $modulo,
161
-                function ($n) {
161
+                function($n) {
162 162
                     $nthOddNumber = SequenceProvider::nthOddNumber($n);
163 163
 
164 164
                     return SequenceProvider::nthEulerZigzag($nthOddNumber->asInt());
165 165
                 },
166
-                function ($n) {
166
+                function($n) {
167 167
 
168 168
                     return SequenceProvider::nthOddNumber($n);
169 169
                 },
170
-                function ($n) {
170
+                function($n) {
171 171
                     return SequenceProvider::nthOddNumber($n)->factorial();
172 172
                 },
173 173
                 0,
174
-                $precision + 1
174
+                $precision+1
175 175
             );
176 176
         }
177 177
 
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 
205 205
         if ($mod2Pi->isEqual(0)) {
206 206
             return $this->setValue(static::INFINITY);
207
-        } elseif($modPi->isEqual(0)) {
207
+        } elseif ($modPi->isEqual(0)) {
208 208
             return $this->setValue(static::NEG_INFINITY);
209 209
         }
210 210
 
Please login to merge, or discard this patch.
src/Samsara/Fermat/Types/Traits/Decimal/PrecisionTrait.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
                 $rounded = $whole.'.';
56 56
 
57
-                for ($i = 0;$i < $decimals;$i++) {
57
+                for ($i = 0; $i < $decimals; $i++) {
58 58
                     $rounded .= $fractionalArr[$i];
59 59
                 }
60 60
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
         $total = strlen($fractional);
143 143
         $fractional = ltrim($fractional, '0');
144 144
 
145
-        return ($total - strlen($fractional));
145
+        return ($total-strlen($fractional));
146 146
     }
147 147
 
148 148
     /**
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
     public function isFloat(): bool
225 225
     {
226 226
 
227
-        return (bool)ArithmeticProvider::compare($this->getDecimalPart(), '0');
227
+        return (bool) ArithmeticProvider::compare($this->getDecimalPart(), '0');
228 228
 
229 229
     }
230 230
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
             throw new IncompatibleObjectState('Cannot export number as integer because it is out of range');
236 236
         }
237 237
 
238
-        return (float)$this->asReal();
238
+        return (float) $this->asReal();
239 239
 
240 240
     }
241 241
 
Please login to merge, or discard this patch.
src/Samsara/Fermat/Types/Traits/Decimal/InverseTrigonometryTrait.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
         } elseif ($this->isEqual(0)) {
28 28
             $answer = Numbers::makeZero();
29 29
         } else {
30
-            $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision + 2);
30
+            $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision+2);
31 31
             $one = Numbers::makeOne($precision+2);
32 32
 
33 33
             if ($z->abs()->isGreaterThan(1)) {
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
         } elseif ($this->isEqual(1)) {
78 78
             $answer = Numbers::makeZero();
79 79
         } else {
80
-            $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision + 2);
81
-            $one = Numbers::makeOne($precision + 2);
80
+            $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision+2);
81
+            $one = Numbers::makeOne($precision+2);
82 82
 
83 83
             if ($z->abs()->isGreaterThan(1)) {
84 84
                 throw new IntegrityConstraint(
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 
129 129
         $precision = $precision ?? $this->getPrecision();
130 130
 
131
-        $piDivTwo = Numbers::makePi($precision + 2)->divide(2, $precision + 2);
131
+        $piDivTwo = Numbers::makePi($precision+2)->divide(2, $precision+2);
132 132
 
133
-        $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision + 2);
133
+        $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision+2);
134 134
 
135 135
         $arctan = $z->arctan($precision+2, false);
136 136
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 
152 152
         $precision = $precision ?? $this->getPrecision();
153 153
 
154
-        $one = Numbers::makeOne($precision + 2);
154
+        $one = Numbers::makeOne($precision+2);
155 155
         $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision+2);
156 156
 
157 157
         if ($z->abs()->isLessThan(1)) {
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             );
163 163
         }
164 164
 
165
-        $answer = $one->divide($z, $precision + 2)->arccos($precision + 2);
165
+        $answer = $one->divide($z, $precision+2)->arccos($precision+2);
166 166
 
167 167
         if ($round) {
168 168
             $answer = $answer->roundToPrecision($precision);
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 
180 180
         $precision = $precision ?? $this->getPrecision();
181 181
 
182
-        $one = Numbers::makeOne($precision + 2);
182
+        $one = Numbers::makeOne($precision+2);
183 183
         $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision+2);
184 184
 
185 185
         if ($z->abs()->isLessThan(1)) {
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
             );
191 191
         }
192 192
 
193
-        $answer = $one->divide($z, $precision + 2)->arcsin($precision + 2);
193
+        $answer = $one->divide($z, $precision+2)->arcsin($precision+2);
194 194
 
195 195
         if ($round) {
196 196
             $answer = $answer->roundToPrecision($precision);
Please login to merge, or discard this patch.
src/Samsara/Fermat/Types/Matrix.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
      */
314 314
     public function rotate(bool $clockwise = true): MatrixInterface
315 315
     {
316
-        $tempData =  $clockwise ? $this->rows :  $this->columns;
316
+        $tempData = $clockwise ? $this->rows : $this->columns;
317 317
         $mode = $clockwise ? self::MODE_COLUMNS_INPUT : self::MODE_ROWS_INPUT;
318 318
 
319 319
         $tempData = array_reverse($tempData);
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 
466 466
             foreach ($this->rows as $rowKey => $row) {
467 467
                 $resultArray[$rowKey] = new NumberCollection();
468
-                for ($i = 0;$i < $value->getColumnCount();$i++) {
468
+                for ($i = 0; $i < $value->getColumnCount(); $i++) {
469 469
                     $cellVal = Numbers::makeZero();
470 470
                     /** @var NumberInterface $num */
471 471
                     foreach ($row->toArray() as $index => $num) {
@@ -508,8 +508,8 @@  discard block
 block discarded – undo
508 508
         $newMatrixData = [];
509 509
 
510 510
         // TODO: Implement minors & cofactors method https://www.mathsisfun.com/algebra/matrix-inverse-minors-cofactors-adjugate.html
511
-        for ($i = 0;$i < $columnCount;$i++) {
512
-            for ($r = 0;$r < $columnCount;$r++) {
511
+        for ($i = 0; $i < $columnCount; $i++) {
512
+            for ($r = 0; $r < $columnCount; $r++) {
513 513
 
514 514
             }
515 515
         }
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 
537 537
         $newRows = [];
538 538
 
539
-        for ($i = 0;$i < $this->getRowCount();$i++) {
539
+        for ($i = 0; $i < $this->getRowCount(); $i++) {
540 540
             if ($i === $excludeRow) {
541 541
                 continue;
542 542
             }
Please login to merge, or discard this patch.