From e2a383a064d584a49296768212262870ecc6d57d Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Tue, 13 Jun 2017 20:05:48 +0100 Subject: [PATCH] added thousandsSeparator parameter to the AmountHelper methods --- src/Template/Main/blocks.ctp | 2 +- src/View/Helper/AmountHelper.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Template/Main/blocks.ctp b/src/Template/Main/blocks.ctp index 55283c5..41980df 100644 --- a/src/Template/Main/blocks.ctp +++ b/src/Template/Main/blocks.ctp @@ -63,7 +63,7 @@
Difficulty
Nonce
-
Amount->format($block->Difficulty) ?>
+
Amount->format($block->Difficulty, '') ?>
Nonce ?>
diff --git a/src/View/Helper/AmountHelper.php b/src/View/Helper/AmountHelper.php index 2378206..fffa9b8 100644 --- a/src/View/Helper/AmountHelper.php +++ b/src/View/Helper/AmountHelper.php @@ -5,8 +5,8 @@ namespace App\View\Helper; use Cake\View\Helper; class AmountHelper extends Helper { - public function format($value) { - $value = number_format($value, 8, '.', ','); + public function format($value, $thousandsSeparator = '') { + $value = number_format($value, 8, '.', $thousandsSeparator); $dotIdx = strpos($value, '.'); if ($dotIdx !== false) { $left = substr($value, 0, $dotIdx); @@ -21,13 +21,13 @@ class AmountHelper extends Helper { return $value; } - public function formatCurrency($value) { + public function formatCurrency($value, $thousandsSeparator = '') { $dotIdx = strpos($value, '.'); if ($dotIdx !== false) { $left = substr($value, 0, $dotIdx); $right = substr($value, $dotIdx + 1); - $value = number_format($left, 0, '', ','); + $value = number_format($left, 0, '', $thousandsSeparator); if ((int) $right > 0) { if (strlen($right) === 1) { $value .= '.' . $right . '0';