Completed
Push — master ( 826b7d...469b7d )
by Jordan
16s queued 13s
created
src/Samsara/Fermat/Provider/NumberFormatProvider.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
             $number = str_replace('-', '-'.$currency->value, $number);
34 34
             $number = str_replace('+', '+'.$currency->value, $number);
35 35
         } else {
36
-            $number = $currency->value . $number;
36
+            $number = $currency->value.$number;
37 37
         }
38 38
 
39 39
         return $number;
@@ -71,14 +71,14 @@  discard block
 block discarded – undo
71 71
             $number = $wholePart;
72 72
 
73 73
             if ($decimalPart) {
74
-                $number .= self::getRadixCharacter($format) . $decimalPart;
74
+                $number .= self::getRadixCharacter($format).$decimalPart;
75 75
             }
76 76
         }
77 77
 
78 78
         if (str_contains($posNegChar, '\N')) {
79 79
             $number = str_replace('\N', $number, $posNegChar);
80 80
         } else {
81
-            $number = $posNegChar . $number;
81
+            $number = $posNegChar.$number;
82 82
         }
83 83
 
84 84
         return $number;
@@ -107,17 +107,17 @@  discard block
 block discarded – undo
107 107
         if ($wholeSizeNonZero) {
108 108
             $exponent = $wholeSizeNonZero;
109 109
             $exponent -= 1;
110
-            $mantissa = substr($wholePart, 0, 1) . '.' . substr($wholePart, 1) . $decimalPart;
110
+            $mantissa = substr($wholePart, 0, 1).'.'.substr($wholePart, 1).$decimalPart;
111 111
         } else {
112
-            $exponent = strlen($decimalPart) - $decimalSizeNonZero;
112
+            $exponent = strlen($decimalPart)-$decimalSizeNonZero;
113 113
             $exponent += 1;
114
-            $mantissa = substr($decimalPart, $exponent-1, 1) . '.' . substr($decimalPart, $exponent);
114
+            $mantissa = substr($decimalPart, $exponent-1, 1).'.'.substr($decimalPart, $exponent);
115 115
             $exponent *= -1;
116 116
         }
117 117
 
118 118
         $mantissa = rtrim($mantissa, '0');
119 119
 
120
-        return $negative . $mantissa . 'E' . $exponent . $imaginary;
120
+        return $negative.$mantissa.'E'.$exponent.$imaginary;
121 121
     }
122 122
 
123 123
     /**
@@ -137,18 +137,18 @@  discard block
 block discarded – undo
137 137
         $formatted = '';
138 138
 
139 139
         for ($i = 0;$i < count($numberArr);$i++) {
140
-            $j = $i + 1;
140
+            $j = $i+1;
141 141
 
142 142
             $formatted = $numberArr[$i].$formatted;
143 143
 
144 144
             if ($grouping == NumberGrouping::Standard) {
145
-                if ($j % 3 == 0 && array_key_exists($i+1, $numberArr)) {
145
+                if ($j%3 == 0 && array_key_exists($i+1, $numberArr)) {
146 146
                     $formatted = self::getDelimiterCharacter($format).$formatted;
147 147
                 }
148 148
             } elseif ($grouping == NumberGrouping::Indian) {
149 149
                 if ($j == 3 && array_key_exists($i+1, $numberArr)) {
150 150
                     $formatted = self::getDelimiterCharacter($format).$formatted;
151
-                } elseif (($j - 3) % 2 == 0 && ($j - 3) > 0 && array_key_exists($i+1, $numberArr)) {
151
+                } elseif (($j-3)%2 == 0 && ($j-3) > 0 && array_key_exists($i+1, $numberArr)) {
152 152
                     $formatted = self::getDelimiterCharacter($format).$formatted;
153 153
                 }
154 154
             }
Please login to merge, or discard this patch.
src/Samsara/Fermat/Types/Traits/Decimal/FormatterTrait.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
             $baseValue = $this->trimmedScientificString($scale, $baseValue);
124 124
 
125 125
             if ($this->isNegative()) {
126
-                $baseValue = '-' . $baseValue;
126
+                $baseValue = '-'.$baseValue;
127 127
             }
128 128
 
129 129
             if ($this->isImaginary()) {
@@ -141,18 +141,18 @@  discard block
 block discarded – undo
141 141
      */
142 142
     private function trimmedScientificString(int $scale, string $baseValue): string
143 143
     {
144
-        if ($this->numberOfIntDigits() > $scale + 1) {
145
-            $baseValue = substr($this->getWholePart(), 0, $scale + 1);
144
+        if ($this->numberOfIntDigits() > $scale+1) {
145
+            $baseValue = substr($this->getWholePart(), 0, $scale+1);
146 146
             $baseValue = str_pad($baseValue, $this->numberOfIntDigits(), '0');
147
-        } elseif ($this->getWholePart() == '0' && $this->numberOfSigDecimalDigits() > $scale + 1) {
147
+        } elseif ($this->getWholePart() == '0' && $this->numberOfSigDecimalDigits() > $scale+1) {
148 148
             $baseValue = trim($this->getDecimalPart(), '0');
149
-            $baseValue = substr($baseValue, 0, $scale + 1);
150
-            $baseValue = str_pad($baseValue, $this->numberOfLeadingZeros() + strlen($baseValue), '0', STR_PAD_LEFT);
151
-            $baseValue = '0.' . $baseValue;
152
-        } elseif ($this->numberOfTotalDigits() > $scale + 1) {
149
+            $baseValue = substr($baseValue, 0, $scale+1);
150
+            $baseValue = str_pad($baseValue, $this->numberOfLeadingZeros()+strlen($baseValue), '0', STR_PAD_LEFT);
151
+            $baseValue = '0.'.$baseValue;
152
+        } elseif ($this->numberOfTotalDigits() > $scale+1) {
153 153
             $baseValue = $this->getWholePart()
154 154
                 . '.'
155
-                . substr($this->getDecimalPart(), 0, ($scale + 1) - $this->numberOfIntDigits());
155
+                . substr($this->getDecimalPart(), 0, ($scale+1)-$this->numberOfIntDigits());
156 156
         }
157 157
 
158 158
         return $baseValue;
Please login to merge, or discard this patch.