Skip to content

Commit

Permalink
patch
Browse files Browse the repository at this point in the history
  • Loading branch information
AnourValar committed Apr 19, 2022
1 parent a77a0d3 commit 8ca3337
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/Helpers/NumberHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ class NumberHelper
/**
* Canonize
*
* @param int|float|string|null $amount
* @param int|float|null $amount
* @return int|null
*/
public function encodeMultiple(int|float|string|null $amount): ?int
public function encodeMultiple(int|float|null $amount): ?int
{
if (is_null($amount)) {
return null;
}

return round( round($amount, config('atom.number.multiple_round')) * config('atom.number.multiple') );
return round($amount * config('atom.number.multiple'));
}

/**
Expand All @@ -31,6 +31,7 @@ public function decodeMultiple(?int $amount): float|null
return null;
}

return round($amount / config('atom.number.multiple'), config('atom.number.multiple_round'));
$multiple = config('atom.number.multiple');
return round($amount / $multiple, (mb_strlen($multiple) - 1));
}
}
1 change: 0 additions & 1 deletion src/resources/config/atom.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@

'number' => [
'multiple' => 100,
'multiple_round' => 2,
],
];

0 comments on commit 8ca3337

Please sign in to comment.