Money
in package
implements
Stringable
FinalYes
A monetary amount paired with its ISO 4217 currency.
Storage is a decimal string so float precision never enters the picture; the consumer (or a future arithmetic helper) is responsible for computing totals before the Money value object is constructed. This matches the incoming-mapper contract: the mapper produces ready-to-emit amounts.
Equality and currency validation are the only behaviour. Arithmetic on Money is intentionally out of scope at v1.0; introducing it would require pinning a decimal library (brick/math or ext-bcmath) which we have decided not to take as a hard dependency yet.
Table of Contents
Interfaces
- Stringable
Properties
Methods
- __construct() : mixed
- __toString() : string
- equals() : bool
- eur() : self
- isNegative() : bool
- of() : self
Properties
$amount read-only
public
string
$amount
$currency read-only
public
string
$currency
Methods
__construct()
public
__construct(string $amount, string $currency) : mixed
Parameters
- $amount : string
- $currency : string
__toString()
public
__toString() : string
Attributes
- #[Override]
Return values
stringequals()
public
equals(self $other) : bool
Parameters
- $other : self
Return values
booleur()
public
static eur(string $amount) : self
Parameters
- $amount : string
Return values
selfisNegative()
public
isNegative() : bool
Return values
boolof()
public
static of(string $amount, string $currency) : self
Parameters
- $amount : string
- $currency : string