Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
framework
Math
Calculator.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Framework\Math
;
7
14
class
Calculator
15
{
21
protected
$_delta
= 0.0;
22
26
protected
$priceCurrency
;
27
31
public
function
__construct
(\
Magento
\Framework\Pricing\PriceCurrencyInterface
$priceCurrency
)
32
{
33
$this->priceCurrency =
$priceCurrency
;
34
}
35
43
public
function
deltaRound
(
$price
, $negative =
false
)
44
{
45
$roundedPrice =
$price
;
46
if
($roundedPrice) {
47
if
($negative) {
48
$this->_delta = -
$this->_delta
;
49
}
50
$price
+=
$this->_delta
;
51
$roundedPrice = $this->priceCurrency->round(
$price
);
52
$this->_delta =
$price
- $roundedPrice;
53
if
($negative) {
54
$this->_delta = -
$this->_delta
;
55
}
56
}
57
return
$roundedPrice;
58
}
59
}
Magento\Framework\Math
Definition:
Calculator.php:6
Magento\Framework\Math\Calculator
Definition:
Calculator.php:14
$price
$price
Definition:
product_alert.php:10
Magento\Framework\Math\Calculator\deltaRound
deltaRound($price, $negative=false)
Definition:
Calculator.php:43
Magento\Framework\Math\Calculator\__construct
__construct(\Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency)
Definition:
Calculator.php:31
Magento\Framework\Math\Calculator\$priceCurrency
$priceCurrency
Definition:
Calculator.php:26
Magento
Magento\Framework\Math\Calculator\$_delta
$_delta
Definition:
Calculator.php:21