Skip to content

Commit f6da29b

Browse files
committed
Apply fixes from StyleCI
1 parent e8b1b8a commit f6da29b

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

src/Copper/Copper.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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
/**

src/Copper/Enums/Prefix.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ enum Prefix: int
3232
case RONTO = -27;
3333
case QUECTO = -30;
3434

35-
public function symbol(): string {
36-
return match($this) {
35+
public function symbol(): string
36+
{
37+
return match ($this) {
3738
self::QUETTA => 'Q',
3839
self::RONNA => 'R',
3940
self::YOTTA => 'Y',
@@ -62,7 +63,8 @@ public function symbol(): string {
6263
};
6364
}
6465

65-
public function multipleOfThree(): bool {
66+
public function multipleOfThree(): bool
67+
{
6668
return ! abs(self::value) % 3;
6769
}
6870
}

src/Copper/Enums/Unit.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ enum Unit: string
3636
case SIEVERT = 'Sv';
3737
case KATAL = 'kat';
3838

39-
public function name(): string {
40-
return match($this)
41-
{
39+
public function name(): string
40+
{
41+
return match ($this) {
4242
self::SECOND => 'Second',
4343
self::METRE => 'Metre',
4444
self::GRAM => 'Gram',

0 commit comments

Comments
 (0)