Money
- Full name:
\Qubus\ValueObjects\Money\Money - This class implements:
\Qubus\ValueObjects\ValueObject
Properties
money
currency
Methods
fromNative
Returns a Money object from native int amount and string currency code
- This method is static.
Throws:
__construct
Returns a Money object
public __construct(\Qubus\ValueObjects\Number\IntegerNumber $amount, \Qubus\ValueObjects\Money\Currency $currency): mixed
Parameters:
| Parameter | Type | Description |
|---|---|---|
$amount | \Qubus\ValueObjects\Number\IntegerNumber | Amount expressed in the smallest units of $currency (e.g. cents) |
$currency | \Qubus\ValueObjects\Money\Currency | Currency of the money object |
equals
Tells whether two Currency are equal by comparing their amount and currency
Parameters:
| Parameter | Type | Description |
|---|---|---|
$money | \Qubus\ValueObjects\Money\Money|\Qubus\ValueObjects\ValueObject |
Throws:
getAmount
Returns money amount
Throws:
getCurrency
Returns money currency
add
Add an integer quantity to the amount and returns a new Money object.
Use a negative quantity for subtraction.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$quantity | \Qubus\ValueObjects\Number\IntegerNumber | Quantity to add |
Throws:
multiply
Multiply the Money amount for a given number and returns a new Money object.
public multiply(\Qubus\ValueObjects\Number\RealNumber $multiplier, mixed $roundingMode = null): \Qubus\ValueObjects\Money\Money
Use 0 < RealNumber $multiplier < 1 for division.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$multiplier | \Qubus\ValueObjects\Number\RealNumber | |
$roundingMode | mixed | Rounding mode of the operation. Defaults to RoundingMode::HALF_UP. |
Throws:
__toString
Returns a string representation of the Money value in format "CUR AMOUNT" (e.g.: EUR 1000)
Throws:
Automatically generated on 2025-10-13