Passed
Push — master ( 621c3c...4216b1 )
by Jordan
23:02 queued 16:19
created
src/Samsara/Fermat/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/Types/Decimal.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
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;
@@ -72,12 +72,12 @@  discard block
 block discarded – undo
72 72
                 );
73 73
             }
74 74
             $checkVal = $this->getDecimalPart();
75
-            $checkVal = trim($checkVal,'0');
75
+            $checkVal = trim($checkVal, '0');
76 76
 
77 77
             $this->scale = ($scale > strlen($checkVal)) ? $scale : strlen($checkVal);
78 78
         } else {
79 79
             $checkVal = $this->getDecimalPart();
80
-            $checkVal = trim($checkVal,'0');
80
+            $checkVal = trim($checkVal, '0');
81 81
 
82 82
             if (strlen($checkVal) > 0) {
83 83
                 $this->scale = (strlen($this->getDecimalPart()) > 10) ? strlen($this->getDecimalPart()) : 10;
@@ -122,14 +122,14 @@  discard block
 block discarded – undo
122 122
                 if ($exp > 0) {
123 123
                     $exp -= strlen($right);
124 124
                     if ($exp >= 0) {
125
-                        $right = str_pad($right, $exp - 1, '0').'.0';
125
+                        $right = str_pad($right, $exp-1, '0').'.0';
126 126
                     } else {
127
-                        $right = substr($right, 0, strlen($right) + $exp).'.'.substr($right, strlen($right) + $exp + 1);
127
+                        $right = substr($right, 0, strlen($right)+$exp).'.'.substr($right, strlen($right)+$exp+1);
128 128
                     }
129 129
                 } else {
130 130
                     $exp += strlen($left);
131 131
                     if ($exp >= 0) {
132
-                        $left = substr($left, 0, $exp).'.'.substr($left, $exp + 1);
132
+                        $left = substr($left, 0, $exp).'.'.substr($left, $exp+1);
133 133
                     } else {
134 134
                         $left = '0.'.str_pad($left, $exp, '0', STR_PAD_LEFT);
135 135
                     }
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
      * @param NumberBase $base
275 275
      * @return DecimalInterface|NumberInterface
276 276
      */
277
-    public function setBase(NumberBase $base): DecimalInterface|NumberInterface
277
+    public function setBase(NumberBase $base): DecimalInterface | NumberInterface
278 278
     {
279 279
         $this->base = $base;
280 280
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
      *
287 287
      * @return DecimalInterface|NumberInterface
288 288
      */
289
-    public function abs(): DecimalInterface|NumberInterface
289
+    public function abs(): DecimalInterface | NumberInterface
290 290
     {
291 291
         $newValue = $this->absValue();
292 292
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
      * @param DecimalInterface $num
298 298
      * @return float|int
299 299
      */
300
-    protected static function translateToNative(DecimalInterface $num): float|int
300
+    protected static function translateToNative(DecimalInterface $num): float | int
301 301
     {
302 302
         return ($num->isInt() ? $num->asInt() : $num->asFloat());
303 303
     }
@@ -356,6 +356,6 @@  discard block
 block discarded – undo
356 356
      * @param NumberInterface|string|int|float $mod
357 357
      * @return DecimalInterface
358 358
      */
359
-    abstract public function continuousModulo(NumberInterface|string|int|float $mod): DecimalInterface;
359
+    abstract public function continuousModulo(NumberInterface | string | int | float $mod): DecimalInterface;
360 360
 
361 361
 }
362 362
\ No newline at end of file
Please login to merge, or discard this patch.
src/Samsara/Fermat/Types/Traits/Trigonometry/TrigonometryScaleTrait.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 
39 39
         $thisNum = Numbers::make(Numbers::IMMUTABLE, $this->getValue(NumberBase::Ten), $modScale);
40 40
 
41
-        $twoPi = Numbers::make2Pi($modScale + 2);
42
-        $pi = Numbers::makePi( $scale + 2 );
41
+        $twoPi = Numbers::make2Pi($modScale+2);
42
+        $pi = Numbers::makePi($scale+2);
43 43
 
44 44
         if ($pi->truncate($scale)->isEqual($thisNum->truncate($scale)) || $twoPi->truncate($scale)->isEqual($thisNum->truncate($scale))) {
45 45
             return '0';
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
 
52 52
         $answer = SeriesProvider::maclaurinSeries(
53 53
             $modulo,
54
-            function ($n) use ($scale, $negOne, $one) {
54
+            function($n) use ($scale, $negOne, $one) {
55 55
 
56
-                return $n % 2 ? $negOne : $one;
56
+                return $n%2 ? $negOne : $one;
57 57
             },
58
-            function ($n) {
58
+            function($n) {
59 59
                 return SequenceProvider::nthOddNumber($n);
60 60
             },
61
-            function ($n) {
61
+            function($n) {
62 62
                 return SequenceProvider::nthOddNumber($n)->factorial();
63 63
             },
64 64
             0,
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 
89 89
         $thisNum = Numbers::make(Numbers::IMMUTABLE, $this->getValue(NumberBase::Ten), $modScale);
90 90
 
91
-        $twoPi = Numbers::make2Pi($modScale + 2);
92
-        $pi = Numbers::makePi( $intScale );
91
+        $twoPi = Numbers::make2Pi($modScale+2);
92
+        $pi = Numbers::makePi($intScale);
93 93
 
94 94
         if ($twoPi->truncate($scale)->isEqual($thisNum->truncate($scale))) {
95 95
             return '1';
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
 
106 106
         $answer = SeriesProvider::maclaurinSeries(
107 107
             $modulo,
108
-            function ($n) use ($negOne, $one) {
108
+            function($n) use ($negOne, $one) {
109 109
 
110
-                return $n % 2 ? $negOne : $one;
110
+                return $n%2 ? $negOne : $one;
111 111
             },
112
-            function ($n) use ($intScale) {
112
+            function($n) use ($intScale) {
113 113
                 return SequenceProvider::nthEvenNumber($n, $intScale);
114 114
             },
115
-            function ($n) use ($intScale) {
115
+            function($n) use ($intScale) {
116 116
                 return SequenceProvider::nthEvenNumber($n, $intScale)->factorial();
117 117
             },
118 118
             0,
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     protected function tanScale(int $scale = null): string
132 132
     {
133 133
         $scale = $scale ?? $this->getScale();
134
-        $intScale = $scale + 3;
134
+        $intScale = $scale+3;
135 135
         if (extension_loaded('decimal')) {
136 136
             $intScale = $intScale+$this->numberOfIntDigits();
137 137
         }
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 
280 280
         if ($mod2Pi->isEqual(0)) {
281 281
             return static::INFINITY;
282
-        } elseif($modPi->isEqual(0)) {
282
+        } elseif ($modPi->isEqual(0)) {
283 283
             return static::NEG_INFINITY;
284 284
         }
285 285
 
Please login to merge, or discard this patch.
src/Samsara/Fermat/Provider/ConstantProvider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
             return self::$pi->truncateToScale($digits)->getValue(NumberBase::Ten);
38 38
         }
39 39
 
40
-        $internalScale = ($digits*2) + 10;
40
+        $internalScale = ($digits*2)+10;
41 41
 
42 42
         $C = Numbers::make(Numbers::IMMUTABLE, '10005', $internalScale)->setMode(CalcMode::Precision)->sqrt($internalScale)->multiply(426880);
43 43
         $M = Numbers::make(Numbers::IMMUTABLE, '1', $internalScale)->setMode(CalcMode::Precision);
44 44
         $L = Numbers::make(Numbers::IMMUTABLE, '13591409', $internalScale)->setMode(CalcMode::Precision);
45 45
         $K = Numbers::make(Numbers::IMMUTABLE, '6', $internalScale)->setMode(CalcMode::Precision);
46 46
         $X = Numbers::make(Numbers::IMMUTABLE, '1')->setMode(CalcMode::Precision);
47
-        $sum = Numbers::make(Numbers::MUTABLE,'0', $internalScale + 2)->setMode(CalcMode::Precision);
47
+        $sum = Numbers::make(Numbers::MUTABLE, '0', $internalScale+2)->setMode(CalcMode::Precision);
48 48
         $termNum = 0;
49 49
         $one = Numbers::makeOne($internalScale)->setMode(CalcMode::Precision);
50 50
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
             return self::$e->truncateToScale($digits)->getValue(NumberBase::Ten);
97 97
         }
98 98
 
99
-        $internalScale = $digits + 3;
99
+        $internalScale = $digits+3;
100 100
 
101 101
         $one = Numbers::makeOne($internalScale+5)->setMode(CalcMode::Precision);
102 102
         $denominator = Numbers::make(Numbers::MUTABLE, '1', $internalScale)->setMode(CalcMode::Precision);
Please login to merge, or discard this patch.