From 84520fe103fee266fd834cd43ae055240e332a6b Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 1 Jun 2021 20:07:07 -0600 Subject: [PATCH] Update PrettyNumber, add decimal option --- app/Util/Lexer/PrettyNumber.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Util/Lexer/PrettyNumber.php b/app/Util/Lexer/PrettyNumber.php index 4e6a4eba..faf26701 100644 --- a/app/Util/Lexer/PrettyNumber.php +++ b/app/Util/Lexer/PrettyNumber.php @@ -4,7 +4,7 @@ namespace App\Util\Lexer; class PrettyNumber { - public static function convert($number) + public static function convert($number, $showDecimals = true) { if(!is_integer($number)) { return $number; @@ -14,7 +14,7 @@ class PrettyNumber foreach ($abbrevs as $exponent => $abbrev) { if(abs($number) >= pow(10, $exponent)) { $display = $number / pow(10, $exponent); - $decimals = ($exponent >= 3 && round($display) < 100) ? 1 : 0; + $decimals = !$showDecimals ? 0 : ($exponent >= 3 && round($display) < 100) ? 1 : 0; $number = number_format($display, $decimals).$abbrev; break; }