Class
Price Formatter.
| Name | Description |
|---|---|
PREFIX | |
PRICE | |
SUFFIX |
public function __construct($price, $currency = null)Construct price object.
Parameters
| Type | Name | Description |
|---|---|---|
float | $price | |
Currency | $currency |
public function getValue(): floatThe underlying numeric value supporting the format.
Returns float
public function __toString()Return the default price format with prefix and suffix.
Returns string
public function toFull()Return price with prefix and suffix.
Returns string
public function toPrefixed()Return price with prefix only.
Returns string
public function toSuffixed()Return price with suffix only.
Returns string
public function toNumeric()Return numeric price only.
Returns string
public function format($format = null, $currency = null)Format a price in a given format.
Parameters
| Type | Name | Description |
|---|---|---|
string|null | $format | |
array|null | $currency |
Returns string
public function getCurrency()Return currency property.
Returns Currency\|null
public static function adjustDecimals($amount, $currencyCode)Check the currency code and if it does not support decimal places, round the amount.
Some currencies do not have decimal places as standard.
Parameters
| Type | Name | Description |
|---|---|---|
T | $amount | |
string | $currencyCode |
Returns T\|int
public function isCycleDisabled(): bool