Skip to content

Money

Properties

money

protected \Money\Money $money

currency

protected \Qubus\ValueObjects\Money\Currency $currency

Methods

fromNative

Returns a Money object from native int amount and string currency code

public static fromNative(): \Qubus\ValueObjects\Money\Money|\Qubus\ValueObjects\ValueObject
  • 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

public equals(\Qubus\ValueObjects\Money\Money|\Qubus\ValueObjects\ValueObject $money): bool

Parameters:

Parameter Type Description
$money \Qubus\ValueObjects\Money\Money|\Qubus\ValueObjects\ValueObject

Throws:


getAmount

Returns money amount

public getAmount(): \Qubus\ValueObjects\Number\IntegerNumber

Throws:


getCurrency

Returns money currency

public getCurrency(): \Qubus\ValueObjects\Money\Currency

add

Add an integer quantity to the amount and returns a new Money object.

public add(\Qubus\ValueObjects\Number\IntegerNumber $quantity): \Qubus\ValueObjects\Money\Money

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)

public __toString(): string

Throws:



Automatically generated on 2025-10-13