class Price (View source)

Methods

__construct(mixed $value, Currency $currency, int $unitQty = 1)

Initialise the Price datatype.

void
__get(string $name)

Getter for methods/properties.

string
__toString()

Cast class as a string.

float
decimal($rounding = true)

Get the decimal value.

float
unitDecimal($rounding = true)

Get the decimal unit value.

string
formatted($locale = null, $formatterStyle = NumberFormatter::CURRENCY, $decimalPlaces = null, $trimTrailingZeros = true)

Format the value with the currency.

string
unitFormatted($locale = null, $formatterStyle = NumberFormatter::CURRENCY, $decimalPlaces = null, $trimTrailingZeros = true)

Format the unit value with the currency.

formatValue($value, $locale = null, $formatterStyle = NumberFormatter::CURRENCY, $decimalPlaces = null, $trimTrailingZeros = true)

No description

Details

__construct(mixed $value, Currency $currency, int $unitQty = 1)

Initialise the Price datatype.

Parameters

mixed $value
Currency $currency
int $unitQty

void __get(string $name)

Getter for methods/properties.

Parameters

string $name

Return Value

void

string __toString()

Cast class as a string.

Return Value

string

float decimal($rounding = true)

Get the decimal value.

Parameters

$rounding

Return Value

float

float unitDecimal($rounding = true)

Get the decimal unit value.

Parameters

$rounding

Return Value

float

string formatted($locale = null, $formatterStyle = NumberFormatter::CURRENCY, $decimalPlaces = null, $trimTrailingZeros = true)

Format the value with the currency.

Parameters

$locale
$formatterStyle
$decimalPlaces
$trimTrailingZeros

Return Value

string

string unitFormatted($locale = null, $formatterStyle = NumberFormatter::CURRENCY, $decimalPlaces = null, $trimTrailingZeros = true)

Format the unit value with the currency.

Parameters

$locale
$formatterStyle
$decimalPlaces
$trimTrailingZeros

Return Value

string

protected formatValue($value, $locale = null, $formatterStyle = NumberFormatter::CURRENCY, $decimalPlaces = null, $trimTrailingZeros = true)

No description

Parameters

$value
$locale
$formatterStyle
$decimalPlaces
$trimTrailingZeros