@@ -46,7 +46,7 @@ public function __construct(
46
46
}
47
47
48
48
/**
49
- * { @inheritdoc}
49
+ * @inheritdoc
50
50
*/
51
51
public function convert ($ amount , $ scope = null , $ currency = null )
52
52
{
@@ -58,17 +58,15 @@ public function convert($amount, $scope = null, $currency = null)
58
58
}
59
59
60
60
/**
61
- * { @inheritdoc}
61
+ * @inheritdoc
62
62
*/
63
63
public function convertAndRound ($ amount , $ scope = null , $ currency = null , $ precision = self ::DEFAULT_PRECISION )
64
64
{
65
- $ currentCurrency = $ this ->getCurrency ($ scope , $ currency );
66
- $ convertedValue = $ this ->getStore ($ scope )->getBaseCurrency ()->convert ($ amount , $ currentCurrency );
67
- return round ($ convertedValue , $ precision );
65
+ return $ this ->roundPrice ($ this ->convert ($ amount , $ scope , $ currency ), $ precision );
68
66
}
69
67
70
68
/**
71
- * { @inheritdoc}
69
+ * @inheritdoc
72
70
*/
73
71
public function format (
74
72
$ amount ,
@@ -82,7 +80,7 @@ public function format(
82
80
}
83
81
84
82
/**
85
- * { @inheritdoc}
83
+ * @inheritdoc
86
84
*/
87
85
public function convertAndFormat (
88
86
$ amount ,
@@ -97,7 +95,7 @@ public function convertAndFormat(
97
95
}
98
96
99
97
/**
100
- * { @inheritdoc}
98
+ * @inheritdoc
101
99
*/
102
100
public function getCurrency ($ scope = null , $ currency = null )
103
101
{
@@ -148,13 +146,22 @@ protected function getStore($scope = null)
148
146
}
149
147
150
148
/**
151
- * Round price
149
+ * @inheritdoc
150
+ */
151
+ public function round ($ price )
152
+ {
153
+ return round ($ price , 2 );
154
+ }
155
+
156
+ /**
157
+ * Round price with precision
152
158
*
153
159
* @param float $price
160
+ * @param int $precision
154
161
* @return float
155
162
*/
156
- public function round ($ price )
163
+ public function roundPrice ($ price, $ precision = self :: DEFAULT_PRECISION )
157
164
{
158
- return round ($ price , 2 );
165
+ return round ($ price , $ precision );
159
166
}
160
167
}
0 commit comments