@@ -116,7 +116,7 @@ |
||
116 | 116 | } |
117 | 117 | |
118 | 118 | if ($this instanceof TransmutableTypeInterface) { |
119 | - return $this(Type::ARRAY); |
|
119 | + return $this(Type::array); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | throw $this->createInvalidTransformationException('array'); |
@@ -37,8 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function add(string $leftOperand, string $rightOperand, int $precision = 0) : string |
39 | 39 | { |
40 | - return (string) ($this->isIntOperation($precision) ? (intval($leftOperand) + intval($rightOperand)) : |
|
41 | - round(floatval($leftOperand) + floatval($rightOperand), $precision, $this->roundingStrategy)); |
|
40 | + return (string) ($this->isIntOperation($precision) ? (intval($leftOperand) + intval($rightOperand)) : round(floatval($leftOperand) + floatval($rightOperand), $precision, $this->roundingStrategy)); |
|
42 | 41 | } |
43 | 42 | |
44 | 43 | /** |
@@ -52,8 +51,7 @@ discard block |
||
52 | 51 | */ |
53 | 52 | public function subtract(string $leftOperand, string $rightOperand, int $precision = 0) : string |
54 | 53 | { |
55 | - return (string) ($this->isIntOperation($precision) ? (intval($leftOperand) - intval($rightOperand)) : |
|
56 | - round($leftOperand - $rightOperand, $precision, $this->roundingStrategy)); |
|
54 | + return (string) ($this->isIntOperation($precision) ? (intval($leftOperand) - intval($rightOperand)) : round($leftOperand - $rightOperand, $precision, $this->roundingStrategy)); |
|
57 | 55 | } |
58 | 56 | |
59 | 57 | /** |
@@ -67,8 +65,7 @@ discard block |
||
67 | 65 | */ |
68 | 66 | public function multiply(string $leftOperand, string $rightOperand, int $precision = 0) : string |
69 | 67 | { |
70 | - return (string) ($this->isIntOperation($precision) ? (intval($leftOperand) * intval($rightOperand)) : |
|
71 | - round($leftOperand * $rightOperand, ($precision ?? 0), $this->roundingStrategy)); |
|
68 | + return (string) ($this->isIntOperation($precision) ? (intval($leftOperand) * intval($rightOperand)) : round($leftOperand * $rightOperand, ($precision ?? 0), $this->roundingStrategy)); |
|
72 | 69 | } |
73 | 70 | |
74 | 71 | /** |
@@ -82,8 +79,7 @@ discard block |
||
82 | 79 | */ |
83 | 80 | public function divide(string $leftOperand, string $rightOperand, int $precision = 0) : string |
84 | 81 | { |
85 | - return (string) ($this->isIntOperation($precision) ? (intval($leftOperand) / intval($rightOperand)) : |
|
86 | - round($leftOperand / $rightOperand, $precision, $this->roundingStrategy)); |
|
82 | + return (string) ($this->isIntOperation($precision) ? (intval($leftOperand) / intval($rightOperand)) : round($leftOperand / $rightOperand, $precision, $this->roundingStrategy)); |
|
87 | 83 | } |
88 | 84 | |
89 | 85 | /** |
@@ -194,7 +190,7 @@ discard block |
||
194 | 190 | return $this->gamma((string) $operand); |
195 | 191 | } |
196 | 192 | |
197 | - $factorial = function (string $num) use (&$factorial) { |
|
193 | + $factorial = function(string $num) use (&$factorial) { |
|
198 | 194 | if ($num < 2) { |
199 | 195 | return 1; |
200 | 196 | } |
@@ -215,7 +211,7 @@ discard block |
||
215 | 211 | */ |
216 | 212 | public function gcd(string $leftOperand, string $rightOperand) : string |
217 | 213 | { |
218 | - $gcd = function (string $a, string $b) use (&$gcd) { |
|
214 | + $gcd = function(string $a, string $b) use (&$gcd) { |
|
219 | 215 | return $b ? $gcd($b, strval($a % $b)) : $a; |
220 | 216 | }; |
221 | 217 | |
@@ -253,7 +249,7 @@ discard block |
||
253 | 249 | public function nextPrime(string $operand) : string |
254 | 250 | { |
255 | 251 | $operand = (intval($operand) + 1); |
256 | - for ($i = $operand;; ++$i) { |
|
252 | + for ($i = $operand; ; ++$i) { |
|
257 | 253 | if ($this->isPrime(strval($i))) { |
258 | 254 | break; |
259 | 255 | } |