Свойство | Type | Description | |
---|---|---|---|
$amount | string | The money amount | |
$currency | The amount currency |
Méthode | Description | |
---|---|---|
__callStatic ( string $method, array $arguments ) : |
Convenience factory method for a Money object | |
add ( |
Returns a new Money object that represents the sum of this and another Money object | |
amount ( ) : string | Returns the value represented by this Money object | |
convertTo ( |
Converts the currency of this Money object to a given target currency with a given conversion rate | |
currency ( ) : |
Returns the currency of this Money object | |
divideBy ( numeric $divisor ) : |
Returns a new Money object that represents the divided value by the given factor | |
equals ( |
Checks whether the value represented by this object equals to the other | |
fromAmount ( numeric $amount, |
Creates a Money object from its amount and currency | |
hasSameCurrencyAs ( |
Checks whether a Money has the same Currency as this | |
isGreaterThan ( |
Checks whether the value represented by this object is greater than the other | |
isGreaterThanOrEqualTo ( |
||
isLessThan ( |
Checks whether the value represented by this object is less than the other | |
isLessThanOrEqualTo ( |
||
isNegative ( ) : boolean | Checks if the value represented by this object is negative | |
isPositive ( ) : boolean | Checks if the value represented by this object is positive | |
isZero ( ) : boolean | Checks if the value represented by this object is zero | |
multiplyBy ( numeric $multiplier ) : |
Returns a new Money object that represents the multiplied value by the given factor | |
round ( integer $scale ) : |
Rounds this Money to another scale | |
subtract ( |
Returns a new Money object that represents the difference of this and another Money object |
Méthode | Description | |
---|---|---|
__construct ( string $amount, |
||
assertNumeric ( numeric $value ) | Asserts that a value is a valid numeric string | |
assertSameCurrencyAs ( |
Asserts that a Money has the same currency as this | |
compareTo ( |
Returns an integer less than, equal to, or greater than zero if the value of this object is considered to be respectively less than, equal to, or greater than the other | |
compareTo0 ( ) : integer | Returns an integer less than, equal to, or greater than zero if the value of this object is considered to be respectively less than, equal to, or greater than 0 | |
newInstance ( string $amount ) : |
Returns a new Money instance based on the current one |
$fiveDollar = Money::USD(500);
public static __callStatic ( string $method, array $arguments ) : |
||
$method | string | |
$arguments | array | |
Résultat |
public add ( |
||
$addend | ||
Résultat |
public convertTo ( |
||
$targetCurrency | ||
$conversionRate | numeric | |
Résultat |
public currency ( ) : |
||
Résultat |
public divideBy ( numeric $divisor ) : |
||
$divisor | numeric | |
Résultat |
public static fromAmount ( numeric $amount, |
||
$amount | numeric | |
$currency | ||
Résultat |
public hasSameCurrencyAs ( |
||
$other | ||
Résultat | boolean |
public isGreaterThan ( |
||
$other | ||
Résultat | boolean |
public isGreaterThanOrEqualTo ( |
||
$other | ||
Résultat | boolean |
public isLessThan ( |
||
$other | ||
Résultat | boolean |
public isLessThanOrEqualTo ( |
||
$other | ||
Résultat | boolean |
public isNegative ( ) : boolean | ||
Résultat | boolean |
public isPositive ( ) : boolean | ||
Résultat | boolean |
public multiplyBy ( numeric $multiplier ) : |
||
$multiplier | numeric | |
Résultat |
public subtract ( |
||
$subtrahend | ||
Résultat |