@@ -183,10 +183,13 @@ public static function scientific(): string
183183
184184 /**
185185 * Format the number using SI units and prefixes.
186- * @param Unit $unit SI Unit to display using.
186+ *
187+ * @param Unit $unit SI Unit to display using.
188+ *
187189 * @parm bool $usePrefix Set whether to use prefixes.
188- * @param bool $useThrees Set whether to use only multiples of three in prefixes.
189- * @param int|null $precision Set the precision of the number.
190+ *
191+ * @param bool $useThrees Set whether to use only multiples of three in prefixes.
192+ * @param int|null $precision Set the precision of the number.
190193 * @return string Formatted number.
191194 */
192195 public static function unit (Unit $ unit , bool $ usePrefix = true , bool $ useThrees = true , ?int $ precision = null ): string
@@ -201,13 +204,13 @@ public static function unit(Unit $unit, bool $usePrefix = true, bool $useThrees
201204 $ value = self ::$ value ;
202205 $ exponent = 0 ;
203206
204- if ($ usePrefix ) {
205- $ exponent = (int ) ( floor (log10 (abs ($ value) )));
207+ if ($ usePrefix ) {
208+ $ exponent = (int ) floor (log10 (abs ($ value )));
206209
207210 if ($ useThrees || $ exponent >= 3 ) {
208211 $ options = [
209212 (int ) floor ($ exponent / 3 ) * 3 ,
210- (int ) ceil ($ exponent / 3 ) * 3
213+ (int ) ceil ($ exponent / 3 ) * 3 ,
211214 ];
212215 $ exponent =
213216 abs ($ exponent - $ options [0 ]) < abs ($ options [1 ] - $ exponent )
@@ -218,7 +221,7 @@ public static function unit(Unit $unit, bool $usePrefix = true, bool $useThrees
218221 $ value /= (10 ** $ exponent );
219222 }
220223
221- return self ::$ formatter ->format ($ value ) . ' ' . Prefix::from ($ exponent )->symbol () . $ unit ->value ;
224+ return self ::$ formatter ->format ($ value ). ' ' . Prefix::from ($ exponent )->symbol (). $ unit ->value ;
222225 }
223226
224227 /**
0 commit comments